the other answers should work. however I wanna mention
from java doc:
FileWriter is meant for writing streams of characters. For writing streams of raw bytes, consider using a FileOutputStream.
reading your method codes, you are about to write String to the file, what you were doing is convert String to raw bytes, then write so I think using FileWriter is not a bad idea.
And for the newline problem, Writer has method .write(String), which is convenient to use.