How did you manage to double the content without having
a print statement? Don't just follow the advice of the
people who suggested to use
+< in the open.
You probably need it, but you need more too. You cannot
simply read a line, write a line in a file that you have
open for read/write - it will garble your data horribly.
But since your code fragment doesn't show any print statements,
I expect your real code is different anyway.
Abigail