I want to read a file and modify it but whenever the new file is created everything stays on one line. Therefore, my question is how can I keep line breaks without removing them?

```
public class JavaProgram {

    public static void main(String[] args) {
        String text = "";
        StringBuilder convert = new StringBuilder();
        Scanner keyboard = new Scanner (System.in);

        File file = new File ("PATH");

            try {
                Scanner input = new Scanner (file);
                while (input.hasNextLine()) {
                        text = input.nextLine();

                        char [] arr = text.toCharArray();
                        char [] newArr = encrypt(3, arr);

                        for (int i = 0; i < newArr.length; i++) {
                            convert.append(newArr[i]);
                } catch (IOException e) {
                    e.printStackTrace(); 
                }
                try {
                    PrintWriter printer = new PrintWriter (document);

                    printer.append(convert);
                    printer.close();

                } catch (IOException e) {
                    e.printStackTrace();
                }

```