How could I add collision based offset to the “set world location”?

How could I stop the blocks from going through the ground and other blocks when building? I use linetrace and set world location to determinate the location currently.

351132-ezgifcom-gif-maker-2.gif