Dynamically writing config file