LibreCAD has not tool to trim the middle part of a line.
I usually use divide to split the line at the first trimming entity and then trim the second part at the second trimming entity.
This removes the middle part of a line and keeps both end segments.
Second answer is to use snapping:
https://librecad.readthedocs.io/en/latest/ref/snaps.html?highlight=snap#snapping
investing less than half an hour into Search function can save hours or days of waiting for a solution