If you just wanted to use Drafts, then you could count the number of rows, round down to the nearest even value and halve it to find the actual number of rows to merge. Then use half of that as an offset to merge lines.
Lets say your example is 12 lines long, half of that is 6. This would hopefully mean your draft has 6 emotions followed by 6 times; but your example formatting varies quite a bit in different parts of your post. Consistency is key, though you could also strip out blank lines first.
For line 1 + line 7 you might have something like this within a Drafts script action:
let newContent = ""; newcontent += draft.processTemplate("[[line|1]]") + " " + draft.processTemplate("[[line|7]]") + "/n"
You then repeat to build up the newContent variable across all of your lines and can replace the existing draft content or create a new draft from the newContent variable. If your number of lines varies, it would be better to construct the above as a loop.
But I don’t think this is the right approach.
This approach tackles things a step earlier and to my mind is therefore better in that it isn’t trying to tidy up an earlier issue.
But I still don’t think this is the right approach.
When you capture your emotional state, your device is capable of capturing the time as well. This time could be rounded off to your preferred time frame identifiers if necessary (or passing it in as a parameter to Shortcuts from Due), but THAT is where I think you should be looking at making your changes. This would require no additional trigger activities from you, so it would be an easier end user solution.
If you can’t figure out how to do this yourself, perhaps consider posting a link to a copy of your actual current custom shortcut along with details of your timing/formatting scheme, and we can perhaps go further from there.
Hope that helps.