Although a mailmerge can make a single file containing all of your config.php file contents, you will still have to split those into separate files and save them to the required folders. Word's mailmerge tools do not have the functionality to either create individual output files or create folders for them; you would need a macro for that. The the Many-to-One Mail Merge add-in available from Doug Robbins at
https://skydrive.live.com/?cid=5aedc...615E886B%21566 can output a mailmerge to individual documents. You would still need to supplement that with code to create the folders for those documents and, perhaps, to transfer the files generated by the addin to there.