This is really not how HTTP works. Even if you auto-flush your output from your CGI program, any number of things may get buffered at other points in the network or client.
You should look at JavaScript or other "dynamic web page" mechanisms which get the client to help this task render as desired.