If your ebooks are in KF8 format (azw3 file extension), hightlights are in azw3r files along with other information. The open source python utility KRDS can read azw3r and other similar files.
https://www.mobileread.com/forums/sh...highlight=krds
If you can use the KRDS code to figure out how to write azw3r files, then you can insert highlights.
To know the start and end positions for highlights you need to use KindleUnpack.
https://www.mobileread.com/forums/sh...ad.php?t=61986