The tricky part of building on the Moon or Mars is finding a way to replace the water component in building materials.
On the other hand, why do we need houses on the Moon? There's no weather to protect us from, except solar radiation. This can be easily mitigated by aluminum foil, which is much lighter to transport than heavy 3D house printers and the additional materials needed to make the lunar sand sticky.
On Mars, it's a bit different. The sandstorms can easily blow away aluminum foils. Instead of printing houses, I would rather dig underground since there are no concerns about your underground apartment getting flooded by rain on Mars.