No, in a thermal analysis, you can specify temperature directly on a surface in the GUI. Please review the course videos I suggested for more information on how to perform a thermal analysis. No APDL scripts are required.
(For APDL, in a thermal analysis, "D" command constraints the temperature since it is a DOF constraint; however "BF" specifies the temperature in a structural analysis since it is a 'body force' type of load. However, as noted above, you don't need to use any APDL scripting in Mechanical for what you want to do.)