Ok so I am using ob_flush(); flush(); methods to display each iteration and its working.
ob_flush(); flush();