Redirecting to a file and setting a variable are two very different things. Redirecting output to a file named a does not in any way affect the current value of a variable named a and does not create a variable named a if it did not already exist.
Since we have to assume that you have shown us everything that we need to know to figure out how your script works, all we can say is that:
will give you a syntax error since a variable that has not been assigned a value does not have a numeric value (unless a was set somewhere else and exported into your environment before your script was started) and the if containing the above test will always evaluate to false.