"We are buying an apartment for our parents."
Translation:Kupujemy mieszkanie dla naszych rodziców.
Nasi rodzice = Our parents (our = nasz/nasza/nasze/nasi/nasze depending on gender; rodzic = parent, rodzice = parents).
Nasza rodzina = Our family.
You should choose the case looking at the Polish word. In this case dla takes genitive, so: "dla naszych rodziców" or, in your sentence: "dla naszej rodziny".
If you are not very familiar with the case system, and it can be confusing, you should read some good reference on that on the internet (anything under 'polish cases' I suppose). Apart from universal or general case rules (like accusative for a direct object), prepositions and some verbs require a particular case (in particular meaning), e.g. o + locative, do + genitive, na + instrumental, potrzebować + genitive etc.
For is in most cases translated as dla like in the phrase "a gift for my mother". It can be also used in other contexts where it has a different meaning e.g. "for two hours". You have to learn which Polish preposition is used in a particular expression. Prepositions are always tricky and never translate directly, just like the Spanish prepositions like a can have several different meanings.