I'm not sure....
The only issue I see is this:
output.append(a.toString());
you seem to be evoking the Object Accounts toString method. I'm not sure what that is....
I think you just want to append the account #?
output.append(testInt);
If that no likey not string...
output.append(new Integer(testInt).toString());
or cast to string?
output.append((String)testInt);
Post back if still issues...