TT #31 · Parashas Va’eschanan · Passuk 6:9
And you shall write them on the doorposts of your house and on your gates.
Torah Temimah points to Menachos 34a (writing must be on a scroll / “kesivah tamah,” not carved on stone).
English: The Sages taught: One might have thought he could write it on stones; therefore the verse says “and you shall write them” — that it be a complete writing. It is said here “writing” and it is said there “and he shall write for her a scroll”; just as there it is on a scroll, so here it is on a scroll.
R’ Yishmael #2 (gezerah shavah) — “kesivah / kesivah” plus the requirement of complete writing.
A mezuzah must be written on a scroll (parchment) in complete letters; it may not be carved directly onto the doorpost.