You can use:
tell app “Keyboard Maestro” to importMacros “[xml]”
The xml should be data in the same format as an exported macro. Essentially an array of macros (technically, an array of macro groups each containing a single macro).
So create a couple template macros and export it, and then look at the XML and determine what you need to adjust to create the desired macros.
Note that this is not a feature I think anyone has used, but it is there specifically for cases like this. So it is highly untested, but should work. If you can’t get it working, I’m happy to look in to it further.