function to remove duplicate lines from a file