Measure the distance from the first light to the last to determine how much cable you'll need. Drill holes through the ceiling joists along the cable run to route the cable through. Note that if your lights are positioned parallel to one ceiling joist, you may not need to drill any holes.
Screw a gang box into the ceiling joist about 4 inches from each of the recessed lights. Place the bottom of the gang box 1 inch above the lower edge of the ceiling joist.
Cut a 6-inch-long piece of electrical cable for each of the gang boxes. Remove 1/2 inch of insulation from the black and white wires on each end of the cable. Connect one end of each cable to the recessed light wiring with wire nuts, matching the black and white wires of the lights to the black and white wires of the cable. Slide the other end of the cables into the openings on the sides of the gang boxes.
Cut lengths of cable to link each gang box, one to the other, in series. Prepare the ends of each wire as before. Slide the ends of the cables into the openings in the gang boxes. Match the wires by color and connect them together with wire nuts, until the entire series of lights is connected, one to another, in series.