Creating these files to work everywhere is a bit complex, but I think quite doable with some java knowledge.
I expect you’ve been looking at iCal4j? With this site you’ll see a copuple of examples that are quite eassy to follow and implement in Mendix:
https://ical4j.github.io/ical4j-user-guide/examples/
The module https://appstore.home.mendix.com/link/app/315/Mendix/iCalendar-module implements this library so you might have a look in the java action of this module to get an idea on how to get this working in your case/ app