Is this a coupled thermal-Mechanical analysis or one way linkage of thermal transferred to Mechanical?
To do it entirely in a script means the script would have to take over the entire solution process. Instead you can insert a command snippet for each load step, and specify the load step for which those commands apply:
Or to do it with no commands, insert two contacts. One is the thermal contact. The other is Mechanical contact. For the thermal contact put a reasonable contact thermal conductance coefficient and a very low normal stiffness factor. In the second contact, you can put a very low thermal conductance coefficient and leave normal stiffness factor as program controlled or some reasonable value, like 0.01 For the Contact Step Control, you can see there is a normal stiffness factor where you can set a different one for each load step instead of dead/alive. But you can't vary the thermal conductance coefficient that same way.