Why do i have blood in my stools?

A few months ago i had blood in my stools, stomach pains, diarrhea and constipation. They did some checks at the surgery but didn’t know what it was so sent off a stool sample. A week later i rang up and they told me that i had a gut infection and if the symptoms didn’t clear, then go back to the GP.

The infection went and so did everything else. Apart from the blood, which did go for a short period of time but recently it has come back. The colour is a red/pink colour.
So i have been to the doctors again but they couldn’t find the cause so have told me to book an appointment for an endoscopy.

I have had a couple of hemorrhoids during these months and told the doctor about.
This is what i thought might be causing the blood but he didn’t mention aything.

Has anybody had similar symptoms and found out what the cause was. As always im fearing the worst :( I am 20 years old, male.

Thanks for your time.