Fixed the way data.txt is being written