juanrga gave a correct answer. I will add some further help to pin-point precisely where your reasoning went wrong. I will quote each part of the question and react.
So as I understand it, heat energy of an object is the SUM of all the
kinetic energies of the molecules of the object (upto constant
This part is using terminology incorrectly, and forgetting some of the energy contributions. You should have said:
"Internal energy of an object is the SUM of all the kinetic energies and other energies of the molecules of the object."
The temperature on the other hand is the AVERAGE of the kinetic
energies of all the molecules of the object.
This is roughly ok. It is not quite the exact average (divided by a universal constant) but it is often of that order.
Now when ice is melting at 0 degrees Celsius, the temperature as
measured on a thermometer does not go up.
The common explanation is that any heat being absorbed by the ice is
being used to break the somewhat strong solid solid bonds between the
molecules of the ice.
Here is my question. if heat of an object is what I defined above,
then since all the molecules are increasing in kinetic energy, the
average of the kinetic energy should also increase, meaning the
temperature should increase. But at 0 degrees celsius for ice that
does not seem to be the case.
You should have said:
"If internal energy of an object is what I defined above, then since all the molecules are increasing in energy, the
average of the total energy should also increase. But I notice that the temperature is not increasing. This suggests the kinetic energy is not increasing either. Oh, I see: it could be that the kinetic energy of the molecules is not changing in this example, but their potential energy is changing, and this does not affect the temperature. So whereas there is quite a close relationship between kinetic energy and temperature, the potential energy of the molecules can sometimes be unrelated to the temperature."
If you had said that, you would not have gotten in a muddle. The potential energy here is the fact that if molecules attract one another, then when they are further apart they have more potential energy than when they are close together.
Finally, the strict relationship between temperature and energy is via the entropy. But I decided not to get into that.