Singapore police check IC

Today I was sitting in the common area (in my HDB where people used to sit..., Constructed tables and chairs ) working on my laptop, suddenly three police persons came and asks me “why you are sitting here..., show me your IC” like that, then I showed my IC they wrote something on their paper and says thank you..., I was worried is this illegal

According to what you wrote, you did nothing wrong and this was probably just a random spot check. I wouldn't worry about it. But if you prefer clarity, you could contact the nearest police post and ask.

Than you