First time difficulties

Recently I have met a girl. We’ve been dating for 2 months almost, before her I didn’t have anyone. We tried sex 2 times and I couldn’t penetrate her and maintain erection. Before that, my erection firmness was good all the time when I just watched porn or was sexually aroused by someone or something.
It also her 1st time so it’s painful for her when I penetrate her.
I just noticed that I lose firmness when I notice that it’s painful for her and I don’t see good erection by watching porn anymore. I dont know what happened.
Maybe it seems that my perception of sex has changed?

Its actually my first time having sexual experience and it was quite not what I expected.
I am 26 yo.