write envrironment to file