Hamsters have very poor eyesight so your hamster is probably biting you as you're scaring it.
You need to train hamsters to trust you. Use food to encourage the hamster to come out of it's house first. You need to be committed to training every day and eventually you will be able to handle your hamster.
Hamsters also get used to your voice and smell so talk to your hamster when it is awake. when
Check out the following link for training tips:
https://youtu.be/_qwxJLw7l24
You do need to put in the time with your hamsters. It in worth it when they trust you.