The end goal for Mars at this point is to have people live there. They can build out a base, test equipment, see what works and what doesn't work, all on the moon. The moon is a 2 day trip from Earth, so resupplies, etc., aren't logistically super challenging. Then they can actually try and build out a launch mechanism from the moon to go to Mars, which could drastically reduce the Delta-V necessary to move from Earth orbit to a Mars orbit. Aside from all of that, this is all pretty much brand new technology, so testing things close to home to start with just makes the most sense.