Remember Temperature (in K) is a measure of the average kinetic energy of a single constituent of a system.

Heat is the flow of internal energy from one system to another, across a temperature difference. Heat will flow spontaneously only from a higher temperature region to a lower temperature region, that is from a region with higher average atomic or molecular KE to a region with lower atomic or molecular KE.

The heat capacity of a substance is the amount of heat in Joules which must be added to it, per kilogram, to raise its temperature by 1 K. It is assumed the substance does not change phase while this is happening.

The latent heat is the heat that must be added to a system to change its phase (for example from solid to liquid, or from liquid to gas/vapor, without change in temperature. All the heat goes into increasing the potential energy of the atoms or molecules relative to one another, and none goes into increasing the average kinetic energy of the atoms or molecules.

Note that melting and boiling are cooling processes, since the process absorbs heat without change in temperature!

Phase change animation

Water Phase Diagram.