fix \n error

New: write file in method 'w'