How to prevent file overwriting in processing?
PrintWriter pw = new PrintWriter(new FileOutputStream(
    new File("persons.txt"), 
    true /* append = true */));

The true is the append mode flag.
Also check if you're using 

pw.append(p.toString());
        pw.append("sdf");

https://stackoverflow.com/questions/8210616/printwriter-append-method-not-appending