ive been trying to make a stack of cards which are objects generated using a complex for loop. but what is happening is that the last card in the loop is getting appended as