Please explain what the problem is. What does the code do or not do?
What is written to the file?