I have not personally been this route, but AFAIK Dunhuang to Charklik (Ruoqiang) directly cannot be done except by private tour/expedition using 4 WD. It's extremely sparsely populated so hitchhiking is not an option. Public transport: most likely way to start this off is bus from Dunhuang to Golmud which is daily. Foreigners used to require a permit from the Dunhuang PSB to buy a ticket on this bus, but I've heard in recent years, no longer required. Then it gets trickier, since you need to get from Golmud to Huatugou to Shimiankuang to Ruoqiang in stages.
https://www.lonelyplanet.com/thorntree/forums/asia-north-east-asia/china/hotan-to-golmud
Read this description from 6 years ago--useful though it's in the opposite direction from you. Most important piece of info is the new road makes things much better than older reports, and there is some sort of small bus/minibus system which seems to replace the former only-option of share-car on some segments. Share-car might still be an option if you have a lot of cash and want more comfort/flexibility.
Like Giora, I believe the Golmud-Ruoqiang sections of Qinghai/Xinjiang requires foreigners to have a special permit to pass through, which theoretically should be obtainable through Golmud PSB. However, Golmud doesn't have a reputation for being super-accommodating so they may not be cooperative on this. When in Dunhuang, you might check and see if there is a Dunhuang-Huatugou bus--I've seen mention of one at some point in time. If so, try to get a permit from Dunhuang PSB and go for that (likely it would be a sleeper bus due to distance). At least you'd know where you stand before committing yourself to a potential dead-end route to Golmud and have to turn around and backtrack.
This route is going to be time-consuming and will be more difficult if you don't speak passable Chinese. Don't expect to find much lodging that can/will take foreigners between Golmud and Hotan.

