Answer for this question is good if you want to overwrite your file everytime you rerun your program, but if you want your records to not be lost at rerunning your program, you may want to try this
public void writeAudit(String actionName) {
String whereWrite = "./csvFiles/audit.csv";
try {
FileWriter fw = new FileWriter(whereWrite, true);
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter pw = new PrintWriter(bw);
Date date = new Date();
pw.println(actionName + "," + date.toString());
pw.flush();
pw.close();
} catch (FileNotFoundException e) {
System.out.println(e.getMessage());
} catch (IOException e) {
e.printStackTrace();
}
}