On line 2 change new FileWriter(my_file_name)
to new FileWriter(my_file_name, true)
so you're appending to the file rather than overwriting.
File f = new File("/path/of/the/file");
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(f, true));
bw.append(line);
bw.close();
} catch (IOException e) {
System.out.println(e.getMessage());
}