is there any custom widget that can create a line and specify the degree and length?
or is there a way that I could edit the code of draw tools such that it can add a degree bar to set the degree of the line?
Yes, you should take a look at Tom Selested's Traverse widget:
https://community.esri.com/docs/DOC-9065-traverse-widget-220