When this is complete reverse the engine up to the rolling stock (slowly) and you will be alerted that it is attached. In each instance you will be informed that has attaching mode on in chat. Holding the stake, right-click on the engine then the middle of the rolling stock.
The standard way to connect engines and rolling stock (passenger carriages, goods wagons etc.) is to use a stake. May vary with some train types but the standard default command to access the train's inventory (PC) is R though this can be reconfigured as necessary (Minecraft Technic sometimes has overlapping commands).