I suspect that your update statement is not correct for Zorba. eXist implements an early draft of XQuery Update 1.0. I believe instead that Zorba correctly implemenets XQuery Update 1.0 specification, so your update should conform with this instead: http://www.w3.org/TR/xquery-update-10/
Perhaps something like:
for $file in file:list("../api/entity/p/", true(), "??????.xml")
let $doc := doc(concat("../api/entity/p/", $file))
return
insert node attribute number_of_tenders {count($doc//tender)} into $doc/entity
In particular have a read of http://www.w3.org/TR/xquery-update-10/#id-insert