2nd argument for streamwriter is append (now false on your script),
but do you have to write into file everysecond also? (if not, then could just collect all data first, and save full list in the end).
or at least there shouldn’t be need to open new streamwriter constantly,
can open and create file at start, then write into it, and then close on exit.
ps. can embed scripts to make them more readable, Using code tags properly