Why am I throwing up clear vomit with blood specks?

over the course of a week, i have developed a cough. the cough seems like it is clearing up but For the past 3-4 days, I have been fatigued and have had severe dull stomach pains in my upper stomach, lower chest. It kind of feels like heartburn. it keeps me up all night and i cant sit still because of the pain. yesterday morning, i threw up clear liquid vomit and i noticed that there were oxidized specs of blood in my vomit. i went to the hospital and they gave me pantoprazole sodium and liquid lidodan which is an oral topical anesthetic and told me to drink it with liquid anti-acid. it has since been 1 day and i have vomited again. (i only feel like vomiting in the morning) the vomit was partially clear but half if it was bright red and i also saw more blood specks but they did not look dark and oxidized like the previous time i vomited, instead it looked like fresh blood specks. (prior to vomiting both times i feel a burping sensation and then i vomit, after vomiting i do not feel like i have to puke anymore but i still feel the heartburn sensation.

Did they mention h-pylori or a stomach ulcer?

Any developments?
Did you get an endoscopy?