Write config file