Trying to search for a string and append text only once

Hi

I am trying to search for a particular occurrence of a string in a file, and if found, append another string to the end of that line.

Here is my file contents:

column1 userlist default nowrite=3 output=4
column2 access default nowrite=3

Here is the code:

A="user=1 user=2"
B="mindays"
C="minmonth"
D="minyear"

if ! grep -qw "$A" testfile
then
awk '( $1 == "column1" && $2 == "userlist" && $3 == "default" ) { print $0 " user=1 user=2 "; next }; { print }' testfile > newtestfile
else
echo $A does exist
fi

if ! grep -qw "$B" testfile
then
awk '( $1 == "column2" && $2 == "access" && $3 == "default" ) { print $0 " mindays=5 "; next }; { print }' testfile > newtestfile
else
echo $B does exist
fi

So what I'm trying to do is assign variables to the strings i need to search for, grep the file to see if those strings exists, and if it doesnt, append some text to end of only that line.

It now overwrites the output file each time awk is run. I need the changes to stay after each awk modification.

Can someone please assist?

Thanks

edit: oops. nevermind.