yesterday in music class we had to sing and I really suck.I'm used to sing along with punk songs and stuff.

We had to sing notes like do-re-mi you know and for example I suck at la,can't hit it properly.And after the singing my voice kinda hurt or something so I guess I'm doing something wrong.

How can I practice this?
play scales on your guitar and sing along, practice going higher and lower so as to find your range.
I'm assuming you have a guitar? Play scales up and down and try to reproduce the notes with your voice. That's how I got around familiarizing myself with intervals for my music course. And yes, find a suitable octave
Two bands I'm obsessed about : Coheed and Cambria.