Actually that is kind of tricky! You could say both "kaffen" and "kaffet". Both are correct, but when you say "kaffen" you are actually referring to "the cup of coffee" and not the liquid drink itself. Or did you mean why "the" can be translated as both "en" and "et" in the end of a definite word? It's easier to explain because it is the same as the article: Ett bord -> bordet (a table / the table), Ett ljus -> ljuset (a candle / the candle) En stol -> stolen (a chair / the chair), En soffa -> soffan (a sofa / the sofa). Have I answered your question?
@ arnauti ... my question is same as to kristopher... what is logic to use "et" and "en" for "the"
So we have to put after the noun "en" or "et; it depends of the noun's gender? For exemple if we say "ett barn", we will have "barnet" and not "barnen" because the article in front of the noun is "ett" ?