besides that you posted your code as text
and not inside the
</> code tag
and you use a very old processing 2.2.1 ( any reason for this?)
https://processing.org/download/
i think your problem is that you try define arrays
inside of draw or serial event
( usually it should be defined global and filled in setup )
and
you make that depending on another array variable length “txt”
what is not filled?
and again the question has nothing to with arduino.