Some Problems:
1) Per the first comment, why the loop? You need to execute the subtraction once per click. By the time it stops you'll almost certainly have a large negative number.
2) You generate the random value once (num= ) and then subtract the value from both. Since you don't run the random function again you are subtracting the same number from both.
Also, if you care about being more conventional, the normal way to update the control is via:
document.getElementById('square1').innerHTML= something
. What you're doing is, at the least, rather unconventional.