We are having to do the same for a couple of our sites that need image URL’s sent to them. I had the same problem so I found the repeating portion of the OBX segment.
0(0).OBX(i).#2(0).[0] for example
The “i” being the portion that counts up as it repeats. To keep from having to loop through every OBX segment and find that number then add one to the last I just did this
0(0).OBX(9999).#2(0).[0] for example
Cloverleaf then just adds my new OBX segment 9999 at the end of the message but it numbers it to the next OBX segment for you. Not sure if it’s the “proper” way but it hasn’t failed yet.
This is on CL 5.7