From https://userbase.kde.org/KDE_System_Administration/Configuration_Files

For scripts or modifying files from the command line, the command line app kwriteconfig is very useful. kwriteconfig expects a configuration file name, a group, a key, an optional type and a value, such as:

kwriteconfig --file kickerrc \
             --group General \
             --key AutoHidePanel \
             --type bool \
               true 

From https://manned.org/kwriteconfig/d47c2de0

kwriteconfig is a command line tool to write values in KDE configuration files. Nonexisting files/groups/keys will be created.

This site gives also more detailed information about the syntax of the command.

Typing kwriteconfig --help in terminal will display something helpful. man kwriteconfig does not work, a man-page does not exist in my system.

To read a Kconfig-entry you can use the command kreadconfig. kreadconfig --help displays useful information about the command. A manual does not exist in my system. https://manned.org/kreadconfig/40c5a73d gives more details.

These commands seem to be part of the packages kde-cli-tools,kde-cli-tools-data, these packages should be installed by default in Kubuntu. You use KDE 5 on Ubuntu and these packages might not be installed, you should check that...