I would highly advise against going down this path (i.e. scripting macros), and instead start out with the rhinoscriptsyntax
Python module or jump directly to the RhinoCommon
API. For your case have a look at these methods:
https://developer.rhino3d.com/api/RhinoScriptSyntax/#mesh-MeshMeshIntersection
But before doing any of that, make sure to go through the GHPython basics here (else you’re gonna have a bad tiiime):