This is one of those questions that unfortunately ends up being answered by "If you don't know how to do it already, you're probably not ready to do it." It can be quite a complex undertaking and isn't necessarily fodder for a beginner programmer. It basically breaks down into three separate things:
1. Let the player select what type of thing they wants to place. This could be done via buttons, dropdown lists, etc. None of this functionality is built-in and you will have to assemble it from scratch. Once they've selected the piece they want then...
2. Let the player create instances of the thing they want to build when they click (or whatever the input method is). This is as simple as using instance_create_layer, but it is usually a lot more complicated as...
3. You have to be able to build a data structure that relates to what they are doing. If they are connecting parts, you need to be able to use a map, or a list, or a buffer, etc, just a data type to "graph" the relationships between the pieces. Not only should this data structure keep a reference of each relationship between the pieces, but it should also be storing required information about the part itself so that when the player gets around to using whatever it is they've built, you're able to reliably rebuild the individual pieces and their relationships to each other from only the data you have stored.
If what I've just said seems like gobbledegook, then, as I said at the start, it might be beyond your current level of programming ability. If that's the case, I'd recommend starting with a simpler project, while researching and experimenting with Data Structures and storing information about instances so that you can come back to this project later with a better foundation to build from.