You can use the command $read to search if
your words exists

//echo $read(file.txt, w, *your words here*)

if not exists returns $null, the you can write your line