what is the purpose of cream of tartar in a recipe?

Cream of Tartar is an acidic ingredient without a lot of taste, and it's used (as you note) in helping to stiffen egg whites when beating, as well as helping to prevent crystallization in some sugary desserts.

Well, in a cookie recipe it's most likely that cream of tartar is paired with baking soda for leavening (i.e., creating bubbles and "lift" while baking).