Connections of TX, RX, and GR to the DMC01

Im using the TReX DMC01 and we soldered the TX, RX, and GR to the TX, RX, and GR pins on the motor controller. Well, after about a month of moving it around, the wires eventually broke off because of the constant movement. I was wondering what I can use to secure these wires to the motor controller in a more durable way. I was looking at these:
Would these work since i only need to connect 3 wires, and if these work, how would I use them? I am new to these connectors.

or can i just use these?

You can solder up your own connectors using our 0.1" female header strips, but I think the easiest solution is to make a cable for yourself using our crimp connector housings and wires with precrimped terminals. We also sell the crimp pins by themselves if you want to use our housings with your own wires, and we sell jumper wires, which are our precrimped wires with 1x1 housings already attached.

- Ben