Hello Celine, and welcome to the Death Valley National Park forum.
Traveling from Twentynine Palms to Death Valley via the Mojave National Preserve does not provide much in the way of hotel or motel lodging. As Frisco_Roadrunner already stated, Baker is a place. . . but not much of a place to stay the night. There are two independent type motels there. . . the last review here on TripAdvisor I saw said that the hot water was not what you would call "hot." Lukewarm at best. You get the picture. You get the four walls, but the level of habitability is not what I would call "standard" in any way. Be prepared to accept less than the usual, and you'll survive just fine should you choose Baker as your overnight stop.
I personally wouldn't, however. You could take F_R's response about Shoshone - I honestly hadn't known that there is a motel there - or you could go up Baker grade on Interstate 15 towards Las Vegas and stay in Nipton at the Nipton Hotel, which is down home Mojave Desert lodging, but everything is serviceable and in good repair and works. Nipton is down the I-15 hill grade getting you into Primm, Nevada, and to the right a few miles on Nipton Road. Interesting place to stay, and recommended here on the forums.
Another option is to simply take I-15 north a few more miles and stay at the border locale of Primm. Three modern hotel/casinos there,and they should all be comfortable and be in working order, etc. I've stayed there myself. . . no problems.
Both Nipton, California and Primm, Nevada are about an hour and a half away from Baker in driving time. I'm sorry there isn't any more central location for you, but as this is the Mojave Desert you are visiting, this is as good as it gets here in the "middle of nowhere" as outsiders often tell us.
Whatever you do, please be sure to bring plenty of drinking water with you on your trip. I personally carry a flat (or more) of bottled water with me in my car's trunk. Even in the Springtime, the sunshine can cause you to get thirsty quicker than you may be used to being.
Enjoy your travels with us.