Why do we need to heat the sample slowly to record its melting point?

Several reasons.

1. Heating too fast the sample may melt BEFORE the thermometer reacts so you record a value too low.
2. Ideally one wants to take the melting point while the sample exists in equilibrium between liquid and solid. Heating too fast and that point is passed up so fast that the temperature recorded is above that point.
3. You want to give enough time for the transfer of heat from the outside to the holding device into the sample.