The place to begin is the Chasam Sofer (Masei 1), who addresses the doubled language of the opening verse — "מוצאיהם למסעיהם" and then "מסעיהם למוצאיהם" — and resolves it by connecting the forty-two journeys to the forty-two-letter Divine Name: each encampment lasted until Israel spiritually departed one level and was ready to ascend to the next, so that the journey itself was caused by their inner elevation from one rung to another.
The Chasam Sofer further notes, in that same passage (Chasam Sofer on Torah, Masei 1), that while forty-two journeys correspond to this mystical framework, the Torah actually records forty-eight — the additional ones being those where Israel moved backward, associated with the deaths along the way — and he was in the middle of developing that point when the excerpt breaks off.
The Chasam Sofer's reading of the forty-two journeys as corresponding to a hidden Divine Name resonates with what Noam Elimelekh (Masei 1) teaches explicitly: the forty-two journeys are an allusion to forty-two worlds, each with its own character of judgment or mercy, and a "journey" (מסע) is what happens when sin damages one of those worlds, while "encampment" (חנייה) is the Tzaddik's act of repair.
Sefat Emet (Masei 12) adds a complementary dimension, teaching that Moshe's recording of the journeys "on God's command" means that Israel's passage through the wilderness rectified those dangerous, spiritually hostile places for all future generations — not a flight but a purposeful, structured repair — and Sefat Emet (Masei 8:2) deepens this by reading the alternating "they journeyed — they encamped" rhythm as a spiritual ascent from one Shabbat-like rest to the next, corresponding to the fifty Shabbatot of the year.
On the technical question of whether "on God's command" in the verse modifies the journeys themselves or Moshe's act of writing, Peri Tzadik (Masei 1) summarizes the debate between Ibn Ezra and the Ramban — the Ramban holding that it modifies Moshe's writing — and adds that in any case the Ramban acknowledges the recording of the journeys is a Divine command whose full reason has not been revealed to us.