The response to making a mistake divides into three parts. First, mistakes are fixable. Second, a Torah works differently to mezuzot and tefillin. Third, God’s names work differently to ordinary words.
Mistakes can be fixed
Many people are under the impression that if you make a mistake, you have to toss out the whole sefer and start over. This isn’t true. A mistake, even one tiny wee one, does invalidate the whole Torah – but not permanently. If there’s a mistake in a Torah, you can’t use it until it’s fixed – but you can almost always fix it.
Torah works differently
There’s a rule that mezuzot and tefillin have to have each and every letter written in strict order. So, if you make a mistake when writing a mezuzah, let’s say you leave out a letter, you can’t go back and add that letter unless you erase all the way back – if it was typing, it would be like saying you can’t move the cursor back and insert the letter, you have to backspace all the way to the place where you need the insertion. And sometimes, doing this would entail erasing God’s name, which we absolutely do not do, so sometimes there really is nothing you can do about it and you do have to go back and start over.
But with a mezuzah, this isn’t a disaster, because there are only 713 letters in a mezuzah, and it’ll only take you a few hours to rewrite them. A Torah has 304,805 letters and takes more than a thousand hours to write; having to start over would be so impractical that we would never manage to get any Torahs written at all. So we don’t have this writing-everything-strictly-in-order rule for Torahs.
This means that if you make a mistake in a Torah, you can go back and fix it later and it’s okay. When I make a mistake, I make a mark with pencil in the margin, so that I don’t forget about it. Then later, when the ink is dry, I come back and deal with it.
God’s names work differently
So, most of the time you can go back and fix mistakes.
Sometimes, fixing means you have to erase a word or part of a word – maybe you wrote a word twice, maybe you misspelled, maybe you smeared it. BUT – you can’t erase God’s names. The Torah says that we should blot out the names of idolatrous gods and destroy them, and then it says that we mustn’t do that to our God. Erasing God’s name is tantamount to erasing God – it’s really not a good thing to do – so we don’t do it, ever. So, if you have a mistake that you can’t fix without repairing God’s name, that’s that – you can’t fix it. You take the sheet away, and bury it respectfully. Throwing it in the garbage would be like throwing God in the garbage – again, bad plan – so one buries it, like one would a dead person.
This, by the way, is why we try to refrain from writing God’s names down – because it’s likely to get thrown away, and we don’t want that to happen. Better to make sure it can’t happen by not writing God’s names in the first place.
Parchment is very forgiving stuff. You can scrape ink off it, and because the parchment is thicker than most paper, and because the ink sits on top and doesn’t soak in, it doesn’t leave a great big hole.