junaidhalepota:
hadn't tried it before running it with the code, but definitely not after burning...
Then you need a new servo - but you probably did not need me to tell you that.
The overheating may have been caused by your code trying to force the motor beyond its physical end-stop. Servos are not designed to be able to produce their maximum torque continuously.
...R