Because a text box is not part of the main body of the Word Document, referencing software, such as Endnote, do not have a clear way of sorting the references. Please see the image attached below.
A solution around this issue is to insert a frame, rather than a text box, or to convert your existing text box into a frame. There is also some variation, depending on which version of Microsoft Word you are using. Please see the links below for further information.