The Purpose of Writing a Sefer Torah
Sefer HaChinuch (613) writes:
Among the roots of this mitzvah: For it is known that the way in which men carry out their deeds reflects their degree of preparation for those deeds. Therefore, the Holy One, blessed be He, commanded that each and every man of Israel have a sefer Torah at hand from which he can always study, and that it not be necessary for him to seek one at the house of his friend. In this way, he will learn to fear Hashem, and he will know and understand His mitzvos which "are more precious than gold, and even much fine gold" (Psalms 19:11).