function to set cookie