The text of the Mezuzah scroll is derived from Deuteronomy Chapter 6, Verses 4-9 and Chapter 11, verses 13-21 in which is mentioned "And you shall write them on the doorposts of your homes and on your gates".
Here's the text:
Hear, O Israel: The LORD is our God, the LORD is one. 5 Love the LORD your God with all your heart and with all your soul and with all your strength. 6 These commandments that I give you today are to be on your hearts. 7 Teach them to your children and talk about them when you sit at home and when you walk along the road, when you lie down and when you get up. 8 Bind them as a symbol on your hand and let them be a sign upon your foreheads. 9 Write them on the doorposts of your homes and on your gates.
And it will be if you faithfully obey the commands I am giving you today - to love the LORD your God and to serve him with all your heart and with all your soul - 14 I will send rain on your land in its season, both autumn and spring rains, so that you may gather in your grain, new wine and olive oil. 15 I will provide grass in the fields for your cattle, and you will eat and be satiated. 16 Be careful, or you will be enticed to turn away and worship other gods and bow down to them. 17 Then the G ds' anger will burn against you, and he will shut up the heavens so that it will not rain and the ground will yield no produce, and you will soon perish from the good land G ds' is giving you. 18 Place these words of mine in your hearts and minds; tie them as symbols on your hands and bind them on your foreheads. 19 Teach them to your children, talking about them when you sit at home and when you walk along the road, when you lie down and when you get up. 20 Write them on the doorframes of your houses and on your gates, 21 so that your days and the days of your children may be many in the land G ds' swore to give your ancestors, as many as the days that the heavens are above the earth.