Dear User,
When a solid is heated, its particles gain energy and the motion of its particles increases and consequently, the particle melts. However, when the melted solid is left, its particles loses their energy to the surrounding as the melted solid starts cooling and consequently gets solidified again.