I've had the best luck as follows:
1. Remove old cable.
2. Unscrew the lever from the handlebar band clamp. Usually this is by means of an allen bolt.
3. Thread the new cable through the lever, then through the cable housing. Don't attach to the brake caliper yet.
4. Carefully re-attach the lever.
5. Attach cable to caliper, adjust, clip, finish cable end.