Just do not forget to check for collisions before you spawn the building, otherwise you will end up with stacked buildings, one on top of the other.
My suggestion in steps:
Step 1 - every tick, have the new building sprite follow the cursor (MouseX, MouseY)
Step 2 - Make the new building 50% opacity.
Step 3 - every tick, check for collisions (AKA see if another building is already built on the spot you want to place the new one)
Step 4 - If step 3 has passed (no collisions), then make the building glow green.
If step 3 has not passed (collisions have turned up true) then make the building glow red and do not continue to step 5.
Step 5 - If step 4 has passed successfully and the player clicks the e.g.LMB, then make the building's X,Y the same as the MouseX,MouseY.
In general, what you try to do is a substantial process imo, not just a couple of quick events. You also have to factor in saving the position of the building if you want to create saved games or go back and forth between menus.