Temperature is the property that characterizes the thermal state of two systems in relation to the direction of the flow of heat which is established between them. Temperature is the property that controls the transfer of thermal energy or heat from one system to another. When two systems are thermally equal, no exchange of heat takes place.
When there is a difference in temperature, the heat will tend to move from the warmer system to the system with the lower temperature until a thermal equilibrium is reached.
Temperature does not measure the quantity of thermal energy of a system but it is connected to it.