As noted in the comment, you need a shell to redirect the output of the process (via >).
You can simply add files through this code:
void append(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src, true);
OutputStream out = new FileOutputStream(dst);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}
In your case, call it twice for file1and file2.