You're doing almost everything right. Change your sed
command so it looks like this:
sed -i s/"$oldcount"/"$newcount"/ count
If you have an older version of sed
which does not have the -i option (mine doesn't), you'll get an error message indicating this. In that case, do this instead:
sed s/"$oldcount"/"$newcount"/ count > count.tmp
mv count.tmp count
Hope this helps.