She gave me a pencil and I was able to do the test!
Who was the person who gave you the pencil?
I got the pencil from my teacher and I used it on the test!
While it is good that your teacher was able to help you out, it is better to be more prepared in the future before a test. Otherwise you could fail the test by not being able to take it.
Look, it was a god send! Just let me have it!
It is great that you appreciate your teacher for lending you the pencil. I think a great way to thank her would be to make sure you are prepared for class from now on with a pencil =].