read lines from a file and remove duplicates (duplicated line should be last)
 * input: lines=[A,B,A] -> output: lines=[B,A]