The most common way to write “ice cream” is as two words. The word “ice cream” is a count noun. Depending on your context, you may write “ice-cream” with a hyphen or capitalize it. You are using the correct word in both cases.
Ice cream is a noncount noun
Ice cream is something you’re probably familiar with. But did you know that it is a noncount noun? Non-count nouns can mean the same thing as singular words, but it can also be used in plurals. Ice cream, for example, can be a singular noun that refers only to ice cream cones. It can also be a plural noun, in which case it refers to various types of ice cream.
Ice cream is a non count noun when it’s sold in a container. This is because ice cream is measured in scoops or litres, while it is a ‘thing’ when it is sold in a cone. However, ready-made icecream products are a ‘thing. It is often packaged in a plastic wrapper.