Create Beam From Cad

Sorry i a m not expect in this. i am very basic learning now. I tried to create first beam from autocad. So i create this script. But result was very bad. If u don’t mind, please help me for this script.