Extracting environment variables to a file