This information is stored in a plist file and is easiest to manipulate with PlistBuddy. For example, to set the HTTP proxy name, use:
/usr/libexec/PlistBuddy -c "Set NetworkServices:6CFBA910-E4A0-4418-82E5-66A6480EBC71:Proxies:HTTPProxy
http://my.proxy.com" /Library/Preferences/SystemConfiguration/preferences.plist
Note: 6CFBA910-E4A0-4418-82E5-66A6480EBC71 is a UUID and likely to be unique on each machine. I don't have another Mac handy to check this. If so, you'll need to do some heavy to find out which one is the interface you need to address.
Try man PlistBuddy and/or a web search for more information on how this tool can be used.
Try man PlistBuddy or a web searc for more info on using it.