I have this code
public class program { public static void main(String[] args) { try { String filePath = (args[0]); String st
Because you are overwriting to the same file within the loop. Create the PrintStream outside of the loop not inside the loop and it should write all lines!