Hey, im a virgin, i was about to have sex with my girlfriend, we had foreplay, i fingered her and she stroked me, but just in the few seconds i used to put on a condom i went soft, i tried to get hard again but couldnt. help me pleeeeeeeeeeaaaaaaase
Things like this happen especially during the first time. It most likely occurred because you were nervous. Your brain decided that it did not want to have sex at that time. You have to be calm and comfortable for everything to work right. If you are scared, you are not going to be at your peak performance and you will probably not enjoy the situation as much. Often times, the best thing you can do is slow down and take things one step at a time. Do not rush into something when you are not comfortable. Over time, you will know when the time is right and everything will work perfectly.
Extending foreplay may help but it really is based on how comfortable you are at the time things are happening. One saying about the nervous system of our bodies is that it is divided into two sections - "fight or flight" and "feed or breed." What it means is that if you are scared and are running for your life, your body has no desire to stop for a snack or have sex. Obviously you are not running for your life in your scenario but you probably have enough adrenaline pumping to interrupt the moment. When you lost your erection, even more adrenaline started pumping which ended the moment.
If you can prevent the adrenaline from the beginning because you really are comfortable with the situation, you should not have these problems.