1) flush empties the output buffers, flushing any content to the client.
Sending output to the client is expensive, it takes a lot of CPU, network etc.
In other words, it is slow.
The idea of buffering is to gather all the output untill the script is finished, and then send all the data in one big transmission.
2) Don't make scripts that run forever. Technically they should be killed by the webserver when the client clicks the "stop" button on the browser.
The problem is that if many times this signal is not sent, and the script does not stop. Eventually you will end up with 100's of orphan scripts thatn eat cpu while they don't do anything.
Also, the browser will wait for the script to end before allowing you do anything with the browser, to press the submit button for example.