config writing function