Your teacher is wrong.
Erasing homework in general is not helpful, it denies the actual work a child did and doesn't allow them to see their progress. This is not appropriate behavior.
Additionally, there are two things I noticed that I haven't seen mentioned in other answers - the reply you were given states that the problem was "not writing on the line" - well, no, actually several of the erased numbers do look like they wrote on the line. Looking at the picture, I can pick out (and be pretty certain of) the nine of 29, the one of 16, the seven of 17, and the four of 41, and a few more that are a little hard to be sure between the poor visibility from the erasure and what I can see from a picture. Erasing the "correct" or nearly correct efforts indiscriminately along with the ones "not up to standard" is - not helpful, it doesn't show the student what was right, or even what was better than another effort, leaving them to wildly guess at what would work or not work.
The second point is, the numbers I can make out are sometimes above the line, sometimes a bit below the line, and sometimes on the line. Precision versus accuracy, but it doesn't look to me like the teacher is demanding something that is actually possible at this point.
If all the numbers had been written the same or nearly the same in respect to the line (all centered in the boxes, all above or all dipping below the line) it should be possible to move that precision to the accurate position, that is neatly on the line itself, and some instruction to do and/or penalty for not doing so after warnings might be reasonable since they seem to have the skill needed (though erasing already-written homework is still not a reasonable penalty, in my opinion). That is a response for a student not doing what they know they should.
As it is, it doesn't look like something he can reliably achieve yet and thus not a good subject for demands. He wrote as neatly as he could and still the writing didn't line up exactly, which is exactly to be expected of someone still learning the skill. It would be good to help him develop this skill, possibly including extra practice or marking that calls out the behavior so he can be aware of room to improve, but it is not good to penalize him for not showing a level of skill he doesn't quite have yet - and I count destroying his work as punishment, especially since numbers that seem correct were also erased.
Also, it is worth noting (even to the teacher when or if your speak to them) that their writing is not up to the standard they're fussing over, either - the T and O of the last column are both above the line, and the w's and a's of the assignment dip below the line they're written on, not to mention the corrected number that might-be-three-might-be-five or the missing spaces where they ran out of room. They are not modeling the correct behaviors themselves, for their students to see how it is supposed to be done. Which just reinforces to me that the level of accuracy they are demanding is not reasonable for this situation. If they aren't following it themselves, then how can it be important enough to destroy someone else's work over it, except as just a power play.
It might, might have been appropriate to erase what was written on the page if the assignment had not been done and clearly not been done intentionally (say, writing the literal phrase "the letters 1-50 onown" once and nothing else, or similar attempts at loopholes), since in that case the result was, and the message correctly was, the work assigned has not actually been done, and it does have to be done. But it was not appropriate to erase hard work for the "wrong" of the child not having more skill than they had, and additionally without good clear feedback on what was or was not "good enough" work or how to improve. The message should not be "the work has not been done" when it was, and the message actually needed to be, "more work on this skill was needed, here's how to improve". In this case, it's the teacher's work not being done.
What you can do? I would suggest going to talk to them again, and bring up that the teacher's actions don't seem to be working towards their goal. The way to improve accuracy when writing is by highlighting where it was correct, which includes not also erasing correct numbers, and encouraging the student for showing improvement over time and with practice, which obviously cannot be done with erased work, and teaching techniques that will help and working with the child when practicing, which simply erasing their work and leaving them to redo it all on their own does not do. A child does not learn to improve their skills (especially motor skills) by being punished for not having better skills.
I think it might help in such a conversation for you to point out how feedback (rather than erasure) can help your child learn what they need to do and/or not do in assignments, rather than trial-and-error guessing - and include the little details like the erased numbers were correct or the helpfulness of being able to see improvement. It can help to have the conversation be about a "miscommunication" or a better way to achieve the teacher's goal, rather than arguing why they were wrong. I mean, the teacher was in the wrong, and between the teacher's actions and the administration's lack of response, I would not trust that school easily - but it might be a good idea to try and work with the school and teacher first, in case there might not be good alternatives available for now and to keep them from holding a grudge against your child, even if it means letting them save face when wrong. You should, however, let your child know the teacher made a mistake, even if you can't get the teacher to admit it.