The thing is that we have tried to have sex about 2 or 3 times (we both are virgins) but every time that we try to do it he can't get inside of me and loses his erection
I don't know why it happens but it's really frustrating for him since he thinks that it's his fault.
So I will be really grateful if you help me with this!
It sounds like you're a little more in tune with your boyfriend and get that it's a bit of a problem that 'he thinks that it's his fault'. So that's a really positive start! It's not his 'fault' and it's not even a problem. Our bodies often react to how we feel. While men and boys are often under pressure to act confident, something like losing an erection can be a result of feeling nervous and not-so-comfortable with the intercourse that is about to happen. Often if we do anything new there can be a few attempts until we feel fully ready, so that could contribute. This can also be a good lesson in exploring what works for you guys when erections aren't constant. Which they often aren't, in many relationships and situations.
I don't know what his take on this is, but if he is putting pressure on himself to get an erection and between you you are making it a goal, it is likely to continue being difficult... if it can be something you work around and remove that pressure, then you're going to have more fun either way.
"In between two tall mountains there's a place they call lonesome.
Don't see why they call it lonesome.
I'm never lonesome when I go there." Connie Converse - Talkin' Like You