Config file is one item (if I am understanding correctly) both wwwroot and pointer to moodledata are changes to make to config.php.
Let's not forget database ... moodle uses wwwroot variable to build every internal link to the moodle. So the links to /admin/ have the wwwroot variable added to the front of the data in a row of the database tables. So there is also the task to find those references in multiple tables of the database.
While there is an admin tool to accomplish the feat ... /admin/tool/replace/ where one enters old url ... your http://abc.com/moodle/ and replace with http://def.com/moodle/
That's assuming you can get to that tool.
Alternative might be better ... the moodle DB from old site (abc.com/moodle) must be dumped to an sql file. That sql file is text and can be edited by a true text editor that has search and replace to accomplish the same thing.
Search for: http://abc.com/moodle/ (not that's not just the domain)
Replace with: http://def.com/moodle/
Depending upon the size of the sql and the speed/processing power of the machine you are using to make the changes, it could take some time. I do such things using an sql dump and the nano editor on the new server and it could take a few minutes time.
Once finished and saved, I check the edited .sql file with a command line tool fgrep:
fgrep "http://abc.com/moodle/" nameofsqlfilethathasbeenedited.sql
That's the old url ... if fgrep finds nothing then I'll check for the new:
fgrep "http://def.com/moodle" nameofsqlfilethathasbeenedited.sql
Last command should find the changes ... scroll a lot ... if it does, that's good.
Then I use the nameofsqlfilethathasbeenedited.sql file to import into the new database for the new moodle .... prior to accessing the site. (config.php file has been edited prior to that).
If you've done everything correctly, you should see your new def.com/moodle/ site (it will be slow while cache builds up) and you should be able to login with the same admin credentials you had used for the old site.
Is your new site http:// or https://?