Im not sure if I misunderstood but what you wrote sounds like a two stage steam engine. This is supposed to be a one stage. Steam enters, pushed piston, and then exits. I was thinking of using a poppet valve, but not sure if it would work.
I built a small steam engine from hardware store parts.
Problem: Flywheel doesn't haven enough mass to push piston back into cylinder.
My solution: Attach some sort of valve between cylinder and boiler that regulates the steam. Example: open>close>open>close>open>close
Such that will open one...