If you just want to replace the line if it's there and append it if it's not then you can use this:
Code:
on *:TEXT:*:#:if ($xpack($1-)) write -s $+ $nick "Website Database\db.txt" $+($nick, _, $1, =, $chan, =, $4-)


Spelling mistakes, grammatical errors, and stupid comments are intentional.