Creating Auto Corridor Feature Lines using Python

Well, we can’t help you to create the script, you need to create it by yourself, and share your work and tell us where you get stuck. Then we can try to help you.
I did a search, start with this
Extract feature lines from a corridor - Dynamo (dynamobim.com)