Deuteronomy 17:14; Deuteronomy 17:18

14 Once you have entered the land the LORD your God is giving you and you have taken possession of it and settled down in it, you might say: "Let's appoint a king over us, as all our neighboring nations have done."
18 Instead, when he sits on his royal throne, he himself must write a copy of this Instruction on a scroll in the presence of the levitical priests.