After I run this program out_file contains the content of input_file + the content of out_file before the program ran. Only reason out_file would be empty is if input_file and out_file is empty or non-existing before the program run. There is no file called tmpO because you did change its name.
The only header I had to add was <unistd.h> to be able to use getcwd. In GCC, <string> is included in <iostream>, but I still think it's a good idea to include <string> because this might change in future versions of GCC or if you change to another compiler.