File.WriteAllText empties any existing file and starts it again - so it's probably File.AppendAllText you want to use instead.
But the problem is likely to be where you are storing the data - because you don't give any path information the folder you create will be in the current directory - which in production will be under Program Files and will be write protected for security.
If you specify a full path, then the folder will be created in a "sensible place" instead of under the EXE file, and it's very likely your problem will disappear.
Have a look here: Where should I store my data?
] for some better ideas.