Temperature tells us what degree of heat is present in something (how much the molecules are moving), but it does not tell how much heat energy something contains. For instance, a cup of boiling water has a higher temperature than a tub of warm water, but a tub would contain more heat energy since it contains much more water. Heat energy is related to the quantity of the matter as well as the temperature.
Thermometers are generally used to measure temperature. A thermometer contains an element that expands as it heats and contracts as it cools. When you put a thermometer into some material to measure its temperature, heat transfer occurs until the temperature of the element is the same temperature as the material that is being measured. In a mercury thermometer, mercury is the element that is used to measure temperature.
Thermometer
How does a thermometer works?
Inside a thermometer is a liquid, such as alcohol or mercury. When the liquid comes into contact with something warm, it's particles gain energy, causing the substance to expand and take up more room within the thin tube. The temperature drops with cold contact because the process is reversed.