Plants photosynthesise AND respire. The oxygen they produce during photosynthesis is used for respiration. At night plants only respire.
Respiration is when glucose (in the presence of oxygen) is converted into carbon dioxide and water and releases energy.
Glucose + Oxygen Carbon Dioxide + Water
Did you notice that the equation for respiration is the opposite of photosynthesis??
All living organisms need to respire. Respiration makes the energy needed so you can breathe, move your muscles, pay attention in your science lessons etc etc...