Hey ! Each lever opens a door and closes another, you need to only leave the green door opened to win. You need to do it before the hero gets rid of all the monsters (otherwise it will take you to jail through one of the bad doors) and avoid the monsters to avoid dying.
Hope that helps :)