Could you not just have the macro execute AutoCAD's "dxfout" command and get the dxf file you desire?
Or are you creating it from some other source than AutoCAD? Of course the dxf format will depend if it's an "lwpolyline" or "heavy" polyline, possibly with varying z values, arcs, smoothing...