The difference between "an" and "année" is that the first term implies a a limited period which starts at one point and ends at another point, whereas the second one refers to the duration itself.
When you say: « J’ai vingt-cinq ans », you consider the starting point (day of birth) in relation to the final point (at the time you speak).
When you say: « Il a travaillé vingt-cinq années dans cette usine », you insist on the duration itself, leaving aside the starting point and the final point.
The reason is that French and English are not contructed the same way. In English, the use of article is spare while in French it is extensive. In English, adjectives come in front of nouns and in French they come after. Therefore, with the examples that Duolingo provides you with, little by little you will learn when to translate word to word and when you will have to adapt to the own grammar of each language.
This page might help you: http://www.bertrandboutin.ca/Folder_151_Grammaire/F_f_place_adj.htm