Trouble Expanding Variable in Shell Script

Because the $KMVAR is inside a single quoted string (it is also inside double quotes, but that is irrelevant).

Change it to something like:

/usr/local/bin/emacsclient -e '(w3m-browse-url "'"$KMVAR_SafariURL"'")'

So you have a single quoted string '(w3m-browse-url "' (which itself ends in a double quote), and then a double quoted string "$KMVAR_SafariURL" (containing the variable, and hiding any spaces or other characters inside the double quotes), and then a single quoted string '")' (which starts with a double quote).