I feel really hurt and ashamed when my bf doesn't want to have sex
Why do you think he doesn't want to have sex?
I told him a secret about something that I regret, and now he doesn't want to have sex.
I'm sure it's upsetting that your boyfriend doesn't want to have sex with you, it's good that you were honest with him. Even if it's difficult now, that honesty will help your relationship grow as you two work through the problem.
I don't think he ever loved me.
There's more to a relationship than just sex, and it's normal for someone to not want to have sex with their partner if they are feeling upset. Just because your boyfriend is upset now doesn't mean they never loved you. I think you should talk to your boyfriend and tell him how you're feeling.