To generate a systemd unit named unitname.ext, a corresponding KDL-formatted unit configuration file named unitname.ext.kdl must be provided.
You can use the pull, replace and sd nodes inside each unit configuration file to describe your systemd unit, see Group configuration and Dependencies for a description of these nodes.
Example:
pull { (group) Group1 Group2 } sd { (section) Unit { (set) Description "Unit" } (section) Service { (set) ExecStart "/usr/bin/bash" } }
Just like the respective nodes inside group specification, you can use the pull node for listing groups to include, and the replace node for listing groups to exclude.