Usually you would want to use a CST for this task as opposed to an AST to preserve white space. comments, and structure during the generation. There's not a ton of tools that are designed to handle that for polyglot tools, tree-sitter is one (but it's a parser generator and not a code generator).
I think it would be easier to write for one language rather than N at first.