Mishneh Torah — Positive Mitzvot מצוות עשה, Chapter 18
The full Hebrew text of Mishneh Torah, Positive Mitzvot, Chapter 18, with English translation by Maimonides (Rambam).
לִכְתֹּב הַמֶּלֶךְ סֵפֶר תּוֹרָה לְעַצְמוֹ, יָתֵר עַל הָאֶחָד שֶׁלְּכָל אָדָם, עַד שֶׁיִּהְיֶה לוֹ שְׁתֵּי תּוֹרוֹת, שֶׁנֶּאֱמָר: "וְכָתַב לוֹ אֵת מִשְׁנֵה הַתּוֹרָה הַזֹּאת" (דברים יז, יח).
For the king to write a second Torah scroll for himself in addition to the one which [he is required to write to fulfill the mitzvah incumbent upon] every man. Thus, he will have two Torah scrolls, as [Deuteronomy 17:19] states: "And he shall write for himself a copy of this Torah."