The shortest route is probably the Trans Kalahari Highway via Botswana and Windhoek. The second option is to go via Upington and cross the border to NAM at Vioolsdrif. The second suggestion is IMHO more interesting. There are the Aughrabies Falls. After crossing into NAM you could travel along the spectacular Fish River Canyon north to the B4, where you turn lest (westwards) to Luederitz.
In any case, try not to travel at night. You don't see the landscape, and risk a collision with wild animals, esp. in Botswana.....
Only when we pause to wonder
do we go beyond the limits of our little lives.