Thank you so much it solved the issue.
But i have a question why permissions and ownership are changing when we try to update our config ? so in this case whenever i will update my wordpress by SSH it will broke right ? or do you have some best practics to do so.
Because i'm facing the same issue for another site, i did update the wp-config.php and the site goes down
Thanks a lot for the help