How can the Earth gain or lose weight?

Not much energy lost from the Earth’s interior- the crust is too good an insulator.
Perhaps 40kg of mass equivalent per day (a very rough calculation)

I do not thnk the earth’s core is cooling. It is kept hot by radioactive decay. If it didn’t I think it would be more solid today than it is (after cooling for the last 3 billion years).

Yes, it is kept hot- but it is also emitting heat- eventually the supply of radioactive elements will run out and it will cool down properly.