Yes, "take away" is correct, this sentence is clear and can be used.
However, it does not directly convey that the student will fail the exam if that's what you are trying to say. For this you can say "...the teacher can void your exam." or informally "...the teacher can fail you." Keep it up!