You can either us the Band Maths operator to create a new band which contains the sum of both or you read the data and iterate over the pixels and you add the values.
How you can read and calculate with band data is shown in this example:
Don’t overlook the gpt command line tool for bandmaths: SNAP command-line tutorial; pconvert is used to convert a BEAM DIMAP file with the new bands to RGB images.
The default location for snappy examples is %USERPROFILE%\.snap\snap-python\snappy\examples for Windows CMD, $env:USERPROFILE\.snap\snap-python\snappy\examples for Windows PowerShell, $HOME\.snap\snap-python\snappy\examples for Linux and macOS: