First of all, when you run your script with an "sh" shebang, it's interpreted as a posix-compatible script. And posix doesn't have arrays. You need to specify a shell that does have arrays, like bash or ksh (e.g. #!/bin/bash).
(Note that some shells might still support them anyway, when used to process sh scripts, but you shouldn't rely on it.)
Second, that's about the ugliest, and probably most pointless, chain of filtering commands I've ever seen. Could you give us an example of what the input and desired output for it is, so we can work out something with sed or awk that can do it all at once?
Third,
$(..) is highly recommended over `..`. Don't use backticks any more, please?
Edit: One more. Most shells run the subsequent commands in a pipe chain in subshells. This means that any variables or other environment settings set in them will be lost on exit. So even if it did set the array correctly, the final echo still wouldn't show anything.
http://mywiki.wooledge.org/BashFAQ/024