2D-to-1D Modulated-to-Lock in Successive Magnetic Phase Transitions Associated with Ferroelectricity in ErMn2O5