Besides liquid in the flask, there is also gas, which expands when warmed by the heat of the hand.
The temperature of the gas rises, so the pressure of the gas also grows. Increasing pressure of gas inside leads to the fact that the liquid begins to move upwards, against gravity, to the part of the flask where the pressure is less. When the gas in the lower part cools down, the liquid comes back down again.