The result you are getting is because you are summing each resulting document from the ‘for’ so the result is correct. To get a sum of all @amount attributes you need to reformulate the query thus:
let $values := (for $doc in input()/bank return xs:integer($doc/client/account/depositor/@amount))
return xs:integer(sum($values))
This way the sum function operates on a array of integer values and returns an integer result.