The op gave something to someone in need. So SWNBU.
I once gave a coat to someone homeless instead of a charity shop. He was very happy with it. He didn't berate me for assuming his style, or patronising him!
I think that's just some posters getting irate behalf for the sake of it. While they sit on their laptops and iPads, in the warm, being supercilious.
If you are in need and someone helps you, you can always say no thankyou to what is offered, can you not?
Everyone is different and will want to do different things. I used to give a sandwich to a homeless guy near my local shop whenever i didnt have cash on me, which i paid for on card. A sandwich is better than nothing, which would have been the alternative. Like the op I asked him what filling and it was fine.
And its not just about thinking they'll spend it on drink and drugs, in a lot of cases beggars are organised by gangs who take all their money at the end of the day, or who sit with drugged-up trafficked children in their laps looking like they're sleeping. To those people, a sandwich is a bonus, and in the case of the children, arguments like those waged against the op seem pretty petty.