Sorry, didn’t understand your question correctly. What you want to do is to trigger the ChangeElementTemplateHandler.
commandStack.execute('propertiesPanel.camunda.changeTemplate', {
element: myElement,
oldTemplate: myOldTemplate // optional
newTemplate: myNewTemplate
});