Deuteronomy 17:14; Deuteronomy 17:18

14 When you enter the land the LORD your God is giving you and have taken possession of it and settled in it, and you say, "Let us set a king over us like all the nations around us,"
18 When he takes the throne of his kingdom, he is to write for himself on a scroll a copy of this law, taken from that of the Levitical priests.