Water molecules are more stable than Hydrogen molecule or Oxygen molecule.The temperature of a common fire doesn't supply enough energy to split up water molecule.However if you can supply enough heat, water molecules does split up. When we throw water on fire, supply of fuel (oxygen) to the fire is cut and the fire is extinguished