Help with addition of 2 numbers that are read from a file

I am trying to add free and used memory (so that i can compute percentage used)of remote nodes using shell script. I use the openssh-server,expect tool and ssh script.

1)login.txt (info of nodes):
ip1|username|password
ip2|username|password
.
.
.

3)sshlogin.sh

#!/bin/bash 
FILE=login.txt
CONNECT=./sshlogin.exp
exec 0<$FILE
while read line
do
MyServer=$(echo $line | cut -d'|' -f1)
MyUser=$(echo $line | cut -d'|' -f2)
MyPassword=$(echo $line | cut -d'|' -f3)
$CONNECT $MyPassword $MyServer MyUser>$MyServer.txt
grep buffers/cache $MyServer.txt>mem.txt     
MEMFILE=mem.txt         
exec 0<$MEMFILE
while read line
do
used=$(echo $line | cut -d' ' -f3)
free=$(echo $line | cut -d' ' -f4)
total='expr $used + $free'  #This is my headache can't see 
# what is the problem
echo $used 
echo $free
echo $total
done
done

3)sshlogin.exp:

#!/usr/bin/expect -f
# set Variables
set password [lrange $argv 0 0] 
set ipaddr [lrange $argv 1 1]   
set username [lrange $argv 2 2] 
set timeout -1   
# now connect to remote UNIX box (ipaddr) with given script to execute
spawn ssh $username@$ipaddr
match_max 100000
# Look for passwod prompt
expect "*?assword:*"
# Send password aka $password 
send -- "$password\r"
# send blank line (\r) to make sure we get back to gui
#send -- "\r"
expect "$"
send -- "free -k\r"
expect "$"
send -- "exit\r"
expect "logout"

I am using this to determine if the nodes should be turned off if the memory utilization is below certain threshold.

change code

total='expr $used + $free'

to

total=`expr $used + $free`