Why is "ez egy nem fekete alma, hanem piros" incorrect ?
You are saying it is 'not a black apple', not that it "is a not-black apple". You might have "ez egy nem-fekete alma", but that would be rather unusual.
how about: Ez nem egy fekete alma, hanem piros
Almost perfect: Ez nem egy fekete alma, hanem egy piros.