Square Wave input into Transformer
You'll need to couple the square wave with a capacitor to the transformer because standing DC voltages will just cause heat but there is no problem feeding a transformer with a square wave in principle.

In practice, if you fed a 60Hz "power" square wave to a transformer, the higher order harmonics in the square wave would mean that a regular AC power transformer wouldn't be as efficient as being fed with a sine wave.

A 24V 6 A supply is capable of providing a power of 144 watts and your output requirement is also 144 watts so you need to be aware that you might only get 90% efficiency and expecting 144 watts from the transformer output is a little naive.