You have to flush and close the output file for it to actually save that last buffer full of characters to the disk.
out.flush();
out.close();
The purpose of BufferedWriter is to hold those characters in a buffer in memory until such time as you flush the buffer.
Calling 'close' is supposed to flush as well, so calling that should cause the buffer to be written as well.
There are other possible reasons: I assume you have checked that input.txt is not empty, and that it has at least one newline (\n) in it. This algorithm will write only when it sees a newline, and if no newline exists it will write nothing.
Finally, I don't recommend using 'FileWriter' because the character encoding depends on your operating environment, which can change. It is better to specify 'UTF-8' (or some other specific character encoding) with a OutputStreamWriter and a FileOutputStream.