After the laws of the temple, the Torah teaches us this week about royalty. This would seem a logical continuation of the laws of judges and law enforcers mentioned at the beginning of the parsha. By looking closely, we will be able to see an important lesson for our daily lives.
The mitzvah of appointing a king is written here as one to be done immediately after conquering the Land. One of the laws of the king is that he must write two Torah scrolls, one to be kept in his palace, and the other, to be written in a special way
…וְ כתַב ל֜וֹ אֶת מִשְ נה הַתּוֹ רָ֤ה הַזאֹּת֙ עַל ספֶר מִלִפְ נֵ֖י הַכֹֹּּֽהֲנִִ֥ים הַֹּֽלְוִִיֹּֽם.
When he is seated on his royal throne, he shall have a copy of this Teaching written for him on a scroll by the leviim-kohanim.
The Torah will explain later, in Parshat Vayelech, that the tribe of Levi are responsible for the ritual in the temple, including the aron- the ark,in it, in the holy of holies, is the Torah scroll from which the king must copy his own scroll.