To attach parts to spacecraft in orbit you can transport the parts in the cargo hold of your vessel, dock to it and do the upgrade.
Take a ladder
Besides the part, take a mobility enhancer (ladder), so the Kerbal has something to hold on to, and a junior docking port with you to temporarily dock the vessel.
For construction in orbit, you need an engineer on board.
Make sure the astronaut only has the necessary equipment in their inventory. By default they have a parachute and an EVA pack in this order. If you take them outside for an EVA they take the parachute, and if they let go the hatch, lost forever. For EVA gave them only the EVA pack.
- Right-click the module the astronaut is in
- Move the EVA pack to the first place in the inventory
- Move the parachute to another module
Approach the vessel (see https://pinter.org/archives/13067) and start an EVA with the engineer.
The astronaut has access to inventories in closeby vessels, so keep both vessels close to each other.
You can practice orbital construction on the launch pad and the runway.
- Make sure the Kerbal in EVA is in a stable position, preferably grabbing one of the vessels, as during construction you cannot control them, and they can drift away.
- Click the Build icon on the toolbar on the left side.
- Grab a part from the inventory and place it on the target vessel.
- Rotate the parts with the A S D Q W E buttons, use the left Shift for fine rotation. Hold Alt to snap to nodes on the vessel.