How to alternate redstone signal?

If I understand you right, you want an "ABBA circuit": When you turn the input on, first A turns on and then B, when you turn the input off, first B turns off and then A.

The Minecraft wiki lists multiple designs for those here: https://minecraft.gamepedia.com/Mechanics/Redstone/Miscellaneous_circuits#ABBA_circuit (archive)
More can be found online.

An easy example is this one, using the locking feature of repeaters: