Installing recessed lighting using a switch that used to power on/off a duplex outlet
I would do it a little bit differently.  

First I would tie all the ground wires together and push them into the back of the boxes. 

On the new Romex cable, wrap both ends of the black wire with red tape to mark them.  Red will be the color-code of "Switched-Hot".  

At the lamp, connect the lamp's white to white, the lamp's black or red to the red (switched-hot) wire, and the ground to ground.  Never mix white with ground.

At the switch, connect the "red" wire to one switch terminal, and a black pigtail to the other switch terminal (it may already be that way).  

Then I would wire-nut all the black wires (which aren't marked red, obviously) in the switch box together - these are "always-hot". The pigtail to the switch, the supply, and the downline to the old socket. 

Then I would wire-nut all the white wires together - these are neutral.  The supply, the wire to the lamp, and the wire to the old socket.  

Voilà.  Now, the lamp works, and the old socket now is always-on.