Electric power is converted in the heater element (an electric resistor) so it becomes hot and gives energy by heat transfer to the water. The water heats up and thus stores energy and as it is warmer than the cup material it heats the cup which also stores some energy. The cup being warmer than the air gives a smaller amount of energy (a rate) to the air as a heat loss.