Transistor heating up problem
It is probably normal for your inefficient linear supply.

Temp rise = Rth &times; (Vin - Vout) &times; Iout

e.g. if heat sink is 2&deg;C/W and Vin-Vout is (39V-1V) @ 1A that results in 38W &times; 2&deg;C/W = 76&deg;C rise.  

Using a pulsed inductor on the input will store energy to reduce conduction losses. Or you can improve your heatsink thermal resistance ( e.g. CPU cooler)

Search for PWM buck reg &amp; LM317 solutions.