Once you have beaten each of the guardians (big humanoid monsters in the underground rooms), you will have been given the recipes for all the part of the portal. Once you craft them, they will automatically go into place. To finish the level then, all you have to do is click on the exit sign on top of that portal.