Wiring with source at the box
Identify your new cable going to the ceiling lamp.  Mark the black wire with red tape.    The color of this wire is now red, because the tape overrides the original color.  

Identify the cable going off to the switch.  Mark its white wire with black tape, and mark its black wire with red tape.  

Now join black to black, red to red and white to white.  

Put a blank cover plate over it.  This must remain accessible forever. You can paint over the cover plate but cannot remove it.