It's known as a wobbler steam engine. The cylinder wobbles up and down and while it's moving either lets steam in or out. These are very common in model steam engines. If you google "How a wobbler steam engine works" you'll find lots of videos that will explain it better than me.
@nathantrost7773 Get yourself a copy of the book called "Building Simple Model Steam Engines" by Tubal Cain, it includes easy to follow details for several engines to make. This is one that I made following one of the plans in the book: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-EzgnuaZD7aA.html I can also recommend joining the "Unofficial Mamod Forum" as people there are always building, repairing and tinkering with model steam engines: www.tapatalk.com/groups/modelsteam/ It's a very friendly group and I've learnt a lot from just seeing what other people are doing and it's a good place to ask questions if you don't understand or get stuck on something.