I do not have to be flattered/grateful for their attention

I was walking towards the gate to my flat and I could see two young men loitering. They saw me and I just knew a comment was going to be made. As I walked by, one of them said “Evening”. I ignored. Then another comment came, “Looking beautiful tonight.”
I slammed the gate to my flat and rolled my eyes. I then heard one of them tut and say “Attitude on her!”
I paused at my front door, absolutely fuming at the idea that I should be flattered and/or grateful for their attention, and considered saying something back.
But of course I didn’t. I was a girl, on my own, in a secluded alleyway with two guys and who knows how they might have reacted.
I felt so angry and upset that I couldn’t stand up for myself especially since I’ve had a few brushes with street harassment this month. Those guys went away feeling like they can say stuff like that with no repercussions and I think that’s what annoyed me most.