|
The code is in a loop, from what I can tell from that break statement.
You're opening and closing the file IN the loop. Which opens for writing, not appending. So with each loop iteration, it overwrites the file.
Open and close the file somewhere else and just write to it in the loop.
HTH
|