That's exactly the opposite. Your answer would translate as "כוס קפה שחורה"
In Hebrew, a cup is feminine and coffee is masculine. So if you use the adjective שחור, it refers to the coffee, while if you use שחורה it refers to the cup.
The original sentence uses שחור so it is the coffee that is black, not the cup.
Now over to English. A "black cup of coffee" is a black cup that is intended to be a vessel for coffee. The cup is black. OTOH a "cup of black coffee" is either a vessel intended only for black coffee, or a measure of black coffee, or even the whole thing: a cup filled with black coffee. Regardless, it is the coffee that is black, not the cup.
This is why the best translation is "a cup of black coffee".
To my ear, a cup of black coffee cannot mean a vessel intended only for black coffee, but rather a cup filled with black coffee. A black cup of coffee is not how I would say a cup for coffee which is black; this would be "a black coffee cup' (depending on how you say it; you can run together the 2nd and 3rd word to mean a cup for black coffee, or the 3rd and 4th word in which case it would mean a black cup for coffee; so either the cup or the coffee may be black depending on the rhythm of your reading.