Use separate for loop for the append operation.