Know how to redirect input and output, and know how to append to an existing file. Example: run/usr/local/task with input redirected from blah.txt. and the output appended to file tylk.data Solution import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { File dir = new File(\"run/user/local/task.\"); String source = dir.getCanonicalPath() + File.separator + \"blah.txt\"; String dest = dir.getCanonicalPath() + File.separator + \"tylk.data\"; File fin = new File(source); FileInputStream fis = new FileInputStream(fin); BufferedReader in = new BufferedReader(new InputStreamReader(fis)); FileWriter fstream = new FileWriter(dest, true); BufferedWriter out = new BufferedWriter(fstream); String aLine = null; while ((aLine = in.readLine()) != null) { out.write(aLine); out.newLine(); } // do not forget to close the buffer reader in.close(); // close buffer writer out.close(); } } .