Most people have overly complicated guides for beating the Moon Lord. Heres an easy guide that takes little effort to follow!
Other Terraria Guides:
Building The Arena
All you have to do is make a tiny room with a bed, camp fire, and heart lantern, and also have the right requirements for someone to move into the room, like in this photo. You should also have a heart statue connected to a timer so it summons hearts quickly.
You can see portals from the portal gun on the side of the wall, so theres proof it works!
Note: you're going to need the Solar Eruption to do this part easily. Once you've built a room like this, move the Nurse into it. Set your spawn point at the bed inside. Make sure you have all of your minions summoned. Then wait for him to appear.
When the Moon Lord appears, use the Solar Eruption to attack, and switch between any of the 3 eyes depending upon which ones are open. When your health gets low, quickly use a potion or talk to the Nurse to heal you. Once you have destroyed all 3 eyes, you can go out of the room and run around if you care to, or you can stay cooped up in the room, (which may be harder).
Thats the easy way me and my friend beat the Moon Lord in less than 10 minutes, I died once because I have crappy armor, and not even max health, but the Moon Lord didn't go away due to my friend being there, who had way better armor than me, so he never died. Hope this helps!