How to do it depends on the contents of file1. If file1 only contains one line of text then it should be pretty simple
ifstream file1("filename.txt");
ofstream file2("outfile.txt");
string input = "Hello World";
string line;
file1 >> line;
file2 << line << input;
It becomes a little more complex when the contents of file1 is more than one line. In that case you need to use a loop to read file1 and write to file2.