To ensure your cookie keeps its shape be sure that the dough doesn't get too warm, and the cookie dough holds its form. If it is too loose, then you will need to add more binding ingredients.