I just looked through the code, and if I were to make it I'd probably do it something like this, assuming GetICMSData() is returning the number instead of an array with the number.
PHP Code:
function CountDefUpdates ()
{
$newcount = GetICMSData ("SELECT COUNT(*) FROM desktops WHERE status=\"installed\"",$link);
UpdateICMS("UPDATE desktops SET status = \"dupend\" WHERE status = \"installed\"AND spy_policy_index = 2",$link);
$file="count.txt";
$fp=fopen($file,"r+"); // make it read and write accessible
$ret = fscanf($fp, "%[0-9]", $count);
if(!$ret)
$count = 0; // catch if the file is empty
fseek($fp, 0); // rewind to start of file, to prepare for writing
fprintf($fp, "%d", $count+$newcount);
fclose($fp);
}