HPCC-9743 Speed up #APPEND and #LOOP processing

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Merge pull request #4672 from ghalliday/issue9743

HPCC-9743 Speed up #APPEND and #LOOP processing

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>