Writing to a file using java io