https://openwrt.org/docs/guide-user/base-system/uci#uci_dataobject_model
in this page below commands not working (anymore?) is it wrong or outdated?
Generating a full uci section with a simple copy-paste
This block of code catches the code printed by uci when you add a new section (see above) and reuses it in all the new keys you want to add after it. This automates what would be a very fun typing or copy-paste job. You can also do this in your scripts.
Generic version:
rule_name=$(uci add <config> <section-type>)
uci batch << EOF
set <config>.$rule_name.<option1>='value'
set <config>.$rule_name.<option2>='value'
set <config>.$rule_name.<option3>='value'
...
EOF
uci commit
A working example:
rule_name=$(uci add firewall rule)
uci batch << EOF
set firewall.$rule_name.enabled='1'
set firewall.$rule_name.target='ACCEPT'
set firewall.$rule_name.src='wan'
set firewall.$rule_name.proto='tcp udp'
set firewall.$rule_name.dest_port='111'
set firewall.$rule_name.name='NFS_share'
EOF
uci commit