We are starting the fifth Book of the Torah, D’varim. In the first Parashah, D’varim, Moses summarizes the journey in the wilderness, from the encampment at Mount Sinai (termed Mount Horeb) until the defeat of Kings Sihon and Og. This brings us to the bank of River Jordan.
As I say every year, D’varim was discovered in the reign of King Josiah, who ruled the Kingdom of Judah from 640-609 BCE. He was preceded by his father, King Amon, who ruled for two years until he was assassinated, and his grandfather, King Manasseh, who ruled the Kingdom of Judah for 44 years. Josiah’s father and grandfather instituted idolatrous rituals; the Kingdom of Judah lived under idolatrous gods and rituals for 46 years.
Josiah ascended the throne at age of eight, and probably under the influence of the priests, Josiah began to destroy the idols, and reformed religious practices in the 18th year of his reign. That included the restoration of the First Temple.
In the first phase of the restoration of the Temple, the Book of Kings recounts that the High Priest Hilkiah discovered the Book of D’varim. Probably, the Yahwist priests wrote the early version of the Book of D’varim in connection to the religious reforms. Probably, they wrote in Moses’ words, and they hid it in the Temple because if they discovered it, it would make an impact.
We will never know, but the story in the Book of Kings is satisfying.