add cookie save

fixed newline bug