I think whatever you send, flowers or card, whatever you write, there’s a chance it won’t land well due to how awful they will be feeling. I don’t think there’s anything failsafe you can do in this situation, just bear in mind that if you do send something that isn’t received well it’s likely more about how much pain they’re in than you. The important thing is to send something to show you care and are thinking about them and honouring their baby’s life.
Personally I really appreciated flowers after a loss, it touched me that someone had gone to the time and effort and expense to send them, and good flowers from a florist tend to last a fair while too before needing to be thrown out. I don’t think ‘flowers are a bad idea’ is anywhere near as universal as this thread would suggest. But a card would do the same job of letting them know you’re thinking of them.
Keep it simple. Something like ‘dear friends, I am so sorry to hear of the loss of baby, I can’t begin to imagine what you’re going through. I’m thinking of you and here for you during this very difficult time. Love, OP’
No matter what you write, someone will find something wrong with it (that’s not meant to be mean to anyone, just that with a group of so many readers like MN there are so many opinions you’re bound to find someone who thinks a particular phrase is wrong or inappropriate). You know them, not us. So as long as you don’t write something truly egregious (the ‘god wanted an angel’ shit makes me feel sick) I’m sure you’ll be fine. Personally I never thought an ‘I’m so sad to hear this’ meant the person was trying to make it about their feelings, just that they had empathy for what I was going through and genuinely felt sad alongside me.
You’re very kind to be doing this in the first place. I’d stay away from more personal intimate things like naming a star or sending a memory box unless you’re the closest people to them as that’s really more something for them to consider when they’re ready, and in the shock of immediate grief something that reminds you so starkly the person is dead forever and now will only ever be a memory can be quite disturbing. Just keep it simple, card and/or flowers.