Once you get the value into the variable, you can use sed to do an in-place edit of the file, roughly along these lines:
$ cat test.conf
pass=blahblahblah
port=number
user=someusername
$ export NEWPASS='password'
$ sed -i -e"s/^pass=.*/pass=$NEWPASS/" test.conf
$ cat test.conf
pass=password
port=number
user=someusername
Update, as requested, an example within a bash script that captures the input. Since this is a password, we're using the -s option to read, so that the characters don't echo back to the screen. We also have some examples of primitive condition testing (empty password not permitted) and error trapping to terminate the script early. The superfluous "done" message at the end is to illustrate that the script really does terminate when errors are caught (preventing that final message from showing unless no errors occur). Changing the name of the file passed to sed to a nonexsistent filename will trigger the 'change attempt failed' message.
#!/bin/bash
read -s -p "Please specify the new password: " NEWPASS
echo ""
if test "$NEWPASS" = ""; then
echo "$0: sorry, password cannot be blank" >&2
exit 1;
fi
sed -i -e"s/^pass=.*/pass=$NEWPASS/" test.conf
if test $? -eq 0; then
echo 'password changed' >&2
else
echo 'change attempt failed' >&2
exit 1
fi
echo "done" >&2
Running the example:
$ cat test.conf
pass=blahblahblah
port=number
user=someusername
$ ./pwchange.bash
Please specify the new password: # it wasn't echoed, but I typed 'foo'
password changed
done
$ cat test.conf
pass=foo
port=number
user=someusername