Hola a todos!
First of all, thanks for the trust you have placed in me.
"Una expresión in spanish" , is a femnine word. In the sentence you are telling Amy not to take "La expresión" so literal. For me , it sounds better with "tomarla" , but, it does makes sense if you keep it with "tomarlo". For example, if you change the sentence to a formal situation you would say something like: Es sólo una expresión, Amy, no la tome tan literal" In this case the verb "tomar" doesn't change its gender, since it is preced by the article "La".
Even I, as a native speaker, sometimes find it difficult to try to understand why certain words are masculine vs. feminine. I do understand this can be confusing for spanish learners, since I also have stumble upon genders while trying to learn german (and they have 3 genders!!!). In german the Moon is masculine and the Sun is femenine, whilts in spanish is the total opposite "La luna y el Sol".
About the hamburger example, I would only change the last "lo" for "la" since "hamburguesa" is a feminine word, in this case it is easier for us to determine it because it finished with "a" but, as always, there are exception to this rule. The word for water, "agua" is a masculine word, maybe do to the fact that it starts also with an 'a' so 'La agua' gives us some cacophony, same as english with "a" and "an" . 'A night' , 'an apple" , etc.
Saludos desde Baja California a todos mis amigos estudiantes de español!