load file contents to memory in some data format, X say.
read line edit data
search X for line edit data
if data not in X then add to X
when you have finished adding contents, save X to disk.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.