the temperature remains constant because the given heat is used to increase only the potential energy of the molecules of the given substance (which results in the change of its state) and not the kinetic energy as temperature of a body is actually the measure of the average kinetic energy of its molecules.