TT #108 · Parashas Shoftim · Second Aliyah · Passuk 17:18
And it shall be, when he sits on the throne of his kingdom, that he shall write for himself a copy of this Torah on a scroll, from before the kohanim, the Leviim.
Torah Temimah points to Sanhedrin 22a.
TT lemma: כְּשִׁבְתּוֹ עַל כִּסֵּא מַמְלַכְתּוֹ.
English: ‘When he sits on the throne of his kingdom’ – from the time he sits on the throne of his kingdom.
Derash on the timing (Bavli) — the mitzvah of writing the Torah is triggered by the act of taking the throne.
The king’s duty to write a Sefer Torah begins when he is established on the throne, not merely when designated.