Your example looks a little strange, but assuming I understand correctly, the action below I think will do what you want and deal with a couple of edge cases too.
The action is a single script step and is based on using Drafts’ standard navigation marker definitions (headings in Markdown for example, which I think is what you want), and then shares it. There are lots of examples around Fantastical, and I’m not sure what you are doing exactly to “I export the days entries into calendar every evening using Fantastical”, but hopefully this will be a good starting point for you if nothing else.
let intSelectionStart = editor.getSelectedRange();
let intStart = 0;
let intLength = editor.getText().length;
//If we are after the first heading, set the start
if (editor.navigationMarkerBefore(intSelectionStart) != undefined) intStart = editor.navigationMarkerBefore(intSelectionStart).location;
//If we are after the last heading, respecify the base length before calculation
if (editor.navigationMarkerAfter(intSelectionStart) != undefined) intLength = editor.navigationMarkerAfter(intSelectionStart).location;
intLength = intLength - intStart;
//Share the text in the specifed range