write function

Save datasets in a yaml file