How do you make an end-capped gear cable?
If this is a 3 speed Sturmey Archer or similar system you need a replacement cable. It will come complete with the cable and housing with the ends installed. There are universal replacement cables available (I have one on my 35 year old Raleigh). The shift adjuster ferrule has a clamp/pinch nut attached so a standard shift cable can be used. Checking several on line retailers shows most of the replacement cables (non NOS) use this universal setup