Car cuts off driving or sitting idle. Diagnostic code was crankshaft sensor. on 2006 Mercedes-Benz CLS500

Crankshaft sensor was replaced and the car continues to cut off. Had diagnostics checked again and it gives the same code. The car cannot make it to a dealer unlessed hauled & the nearest dealer is in another state or almost 2 hours away. Please help.

Asked by for the 2006 Mercedes-Benz CLS500