I'm not sure what you want... You can never get a whole file written simultanious, the harddisk isnt fast enough. But if you want all you output to be done in one line of code, you have to save the output in a scalar and when you have everything ready you open your outfile,write this single scalar to your file and close your file again. This is the closets to simutanious you'll get...