Translation:Finally I understood what they were looking for.
The imperfetto is used for actions that lasted an indefinite time in the past; passato prossimo and passato remoto don't have this kind of emphasis on the duration of an action. Since in English you are using the progressive form, the imperfetto is the more natural choice for actions that lasted in the past.
Shouldn't proper English be "Finally I understood for what they were looking."
Theoretically yes, since there is a "rule" that in proper English one does not end a sentence with a preposition. In writing, as far as is possible, we try to follow that rule unless it would result in an awkward sentence. However, in ordinary conversation we often ignore it. In this case, "...for what they were looking" is awkward.
Do not end an English sentence with "for'. Finally I understood for what they were looking (or better "for what they were searching").
I cannot believe that this old canard is still doing the rounds. Of course you can finish a sentence with a preposition, particularly with phrasal verbs like "look for" "look to" "look down on".
A famous counterblast to this "rule" that a sentence cannot end with a preposition is attributed to Churchill, who is supposed to have written: "This is the kind of English up with which I will not put" to point out how ungainly attempts to avoid "This is the kind of English I will not put up with" would be. While in this Duolingo example the rather pompous-sounding "for which they were looking" works perfectly well, if sounding rather affected, other phrasal verbs can be more tricky. Consider: "These are the kind of people I will not down on." To avoid "ending with a preposition" one would have to write "These are the kind of people down on whom I will not look." This sounds ugly, unnatural and is far less easily understood. Part of the reason for this is that the "preposition" here is not a preposition as it is normally understood. Randolph Quirk et al. in "A Comprehensive Grammar of the English Language" use the term "particle" (as sometimes the second part of a phrasal verb is a spatial adverb, as in "get away"). It is therefore quite unnatural to split up the two parts of a phrasal verb, and makes the sentence cumbersome and hard to grasp, because you don't know what the verb is until you have all the parts of a phrasal verb, which is why they (generally) work much better kept together. (Some phrasal verbs have to be split up "laughing my head off" not "laughing off my head".)
In the end, it is better to avoid prescriptivist injunctions, which often come from a simplistic view of grammar.
Finally I understood for what they were looking. Please, no "for" at the end of sentences.