The script is simple, but it is not a simple string. It must be cleaned-up before comparing.
Here is your working script:
*** Test Cases ***
Compare
${abc1}= Set Variable 1\n2
${abc2}= Set Variable 12
Run Keyword If "${abc1.replace('\n','').strip()}" != "${abc2.replace('\n','').strip()}" Log 1234