Hello,
After you have the DOCX merged you just need to use the importHeadersAndFooters method to add the headers to all pages of the document.
The steps are:
1. Generate a new document replacing the content of the template.
2. Merge the DOCX if needed. To do this you need the document of the previous step and the other document to merge with.
3. Import the headers to the document merged in the previous step to add the headers to all pages.
If you want to attach the second page to the end, you'll need to have this second page as a standalone DOCX to be merged. You can't split an existing document.
Regards.