something was by the commandment of the LORD. Still, it seems a bit awkward, and seems to backtrack a bit.
Indeed, this seems like an addendum to sefer Bemidar, and an index of sorts to their various travels in the desert. It gives us a quick overview of their itenerary. That, together with pasuk 2, suggests that this was a separate source, written by Moshe, and incorporated into the Torah at the end of this sefer.
If so, pasuk 2 could be read as a "defense" by the sadran (even saying it is Moshe or Yehoshua) for why this material should be included in the Torah -- that Moshe Rabbenu wrote the following information, which was then incorporated; and furthermore, this writing was עַל-פִּי ה, by the commandment of the LORD, such that it has the same sanctity.
It is actually a machlokes as to the meaning of עַל-פִּי ה, and to what words it binds.
Ibn Ezra writes:
such that their travels were al pi hashem. He is most likely influenced by the earlier pasuk in Bemidbar 9:20, which states על פי ה' יחנו ועל פי ה' יסעו.על פי ה' -
דבק עם למסעיהם.
Ramban argues on Ibn Ezra and says that עַל-פִּי ה refers to the writing which Moshe did:
and (as I read it) he takes that earlier pasuk as a reason not to think that this is what it means locally.והנה מכתב המסעות מצוות השם היא מן הטעמים הנזכרים, או מזולתן עניין לא נתגלה לנו סודו, כי "על פי ה'" דבק עם "ויכתוב משה", לא כדברי ר"א שאמר שהוא דבק עם "למסעיהם", שכבר הודיענו זה (לעיל ט כ): על פי ה' יחנו ועל פי ה' יסעו
Meanwhile, Baal HaTurim claims that the reversal in the second pasuk, of first saying אֶת-מוֹצָאֵיהֶם לְמַסְעֵיהֶם, followed by מַסְעֵיהֶם לְמוֹצָאֵיהֶם, is to show that both מַסְעֵיהֶם and מוֹצָאֵיהֶם were עַל-פִּי ה. I don't agree that this is true on a peshat level, nor am I entirely convinced this is valid on a midrashic level. Still, it appears to demonstrate that he understands עַל-פִּי ה in accordance with Ibn Ezra and not in accordance with Ramban.