Easier to remember if you think graphically -- 立下 (erect down)-- imagine 'erect a flag to mark something' = establish'
他参加过许多战役, 立下了汗马功劳, 但他仍然很谦虚。
The example didn't use the phrase correctly. 汗马功劳 is mostly a 'modest phrase' --stating one's contribution is not a 'credit for heroic deed' but a 'credit for dutifully served'
A general won a war that saved the nation has achieved a 天大功劳 (great credit)
A soldier dutifully fought many battles for the country has accumulated many 汗马功劳 (credit for dutifully served) -- even if most of them were losing ones
Similarly, if you call a fireman hero, he would modestly say "I am not a hero, I am just a guy doing his job" (a guy dutifully doing his job is praise worthy, but not to the point of heroic)
立功 means 'achieve/obtain credit (for contribution)'
下 in 立下功劳 is a result complement that indicates the verb 立 is successful
立下了汗马功劳 = have accumulated credit for dutifully served