The best way to do this is with a fresh shifter cable that has not been cut before. Once the shifter has been released to it's zero cable pull (e.g smallest cog/chainring position for rear/front shifter respectively) you can insert the cable.
With the sram shifters, it actually has to bend quite a bit to go up and out of the shifter itself - you'll need to exert a little bit of force to get it to bend this way if you want it to actually go through. After doing it once successfully you'll understand what this means.