Because there is a difference between the Molecular Formula and the Empirical Formula.
The molecular formula is the formula for a molecule (e.g glucose is C6H12O6). This can be simplified to a 1:2:1 ratio, effectively making the formula CH2O. A molecular formula in its most simple whole number ratio is known as its Empirical formula.
As you should be able to see, a molecule that has the molecular formula CH2O would be very, very differently shaped than glucose.
So to answer, H2O2 CAN be written as HO, but it is not because then the formula would not represent Hydrogen peroxide, and instead represent a hydroxyl (alcohol) group which has very Very different properties than a glucose molecule.