As I understand, wall coordinates (begC , endC). are only available in the C++API. You would also need the relative north pointer angle. There are relative straight forward structures in the API to obtain this info there.
You could then transfer the coordinates for each wall to a Python script via the ExecuteAddOnCommand. Complete the calculations within the script and write the results (direction) to a custom property assigned to each wall. An expression is not capable of doing this. This would be a relative short application for a person knowable with The API or the Python API.
BTW: about a year ago, a wish was accepted to allow expressions to run Python scripts. That would solve your problem. We're still waiting?? However, allowing Python scripts to run with every update would be problematic (IMNSHO).
Windows 10 - Visual Studio 2019; ArchiCAD 26