I would like, however, to find a way to set the content of the sources added without manually making the change through the GUI.
Unfortunately, Kodi does not support magic wands.
And usually adding/changing sources is a one-time-thing only.
So how often are you planning to make source changes?
When creating a new Kodi client, simply copy the relevant files from the Kodi source machine to the new client, either via USB or a network connection.
Should your Kodi device work okay via path substitution, then a simple reboot should be enough to pick up changes in the source.xml file.
Kodi cannot update the sources.xml internally once it has booted/started.