Hi,
We can attempt to use this script for migrating the templates as a reference.
Remember, when dealing with these kinds of operations, it's crucial to thoroughly test the process in a controlled environment before implementing it in a production setting. The exact scripts and steps you need might depend on the specific attributes of your templates, your network infrastructure, and any changes in VMM 2022.