It's hard to say specifically without a better understanding of the data, but here's a start.
Are you looking to add the "ID" field from your text file as an attribute in the "routes" feature class attribute table? If so, presumably there is a field in the "template" file that you would like to use? If so, you need to specify those fields in the insert cursor:
<SPAN class="comment token"># Let's pretend ROUTE_ID is a field already in the template:</SPAN> cur <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>InsertCursor<SPAN class="punctuation token">(</SPAN>routes<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'SHAPE@'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'ROUTE_ID'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Then in your loop:</SPAN> <SPAN class="keyword token">for</SPAN> line <SPAN class="keyword token">in</SPAN> fileinput<SPAN class="punctuation token">.</SPAN>input<SPAN class="punctuation token">(</SPAN>infile<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># ... geoprocessing steps ...</SPAN> cur<SPAN class="punctuation token">.</SPAN>insertRow<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>feat<SPAN class="punctuation token">,</SPAN> ID<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
If you're looking to add a new field to the attribute table, you would just use arcpy.AddField_management before initializing the cursor.
If you're trying to do something totally different than what I assumed, I'd suggest clarifying your question and code so that people can help you out.
Hope this helps...
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.