The answer is: 320 Elm Street, Apartment 21 B, Melville, NY 20010.
When writing addresses in the body of a text, the comma is used to separate the number and street from the apartment number, and then to set apart the city from the state and post code.
When writing addresses on an envelope to be delivered by the post office, no punctuation is needed. For example:
320 Elm Street
Apartment 21 B
Melville
NY 20010