Hello,
You just need to set the target option as 'footer', by default this option is set to 'document' (this is the main body). We recommend you to read the API doc about the method:
https://www.phpdocx.com/api-documentation/templates/replace-variable-text-Word-document
Regards.