How to append an array within a for loop that gets new outputs every loop