Yes, you can substitute butter with margarine in the cookie recipe. However, keep in mind that the texture and taste of the cookies may be slightly different. Butter tends to result in a richer and creamier flavor, while margarine may give a lighter texture. It's always a good idea to use unsalted butter