I am making cinema seat booking system as semester project. I saved person name, movie name and seat numbers attributes in a .txt file with javafx, but the problem is that it overwrites previous record when I make bookings for another person. No matter how many bookings I make it only saves last one because this line FileWriter data=new FileWriter("reservation.txt"); is also called every time. So is there a way to make .txt file in another class and write data in another class, or any other solution?
try{
    FileWriter data=new FileWriter("reservation.txt");
    data.write("Customer Name: "+Cinemafx.name+"    ");
    data.write("Movie Name: "+movieselection.movie_name+"    ");
    data.write("Seat Numbers: "+listString+"    ");
    data.close();
}
    catch(Exception ex){
}
 
     
     
    