I don't think it is because of the vendor number, its rather about the info record number, as this is what you create.
If the vendor number would be wrong then SAP would tell you that the vendor cannot be found.
The method you use to determine a new info record number is very questionable.
How do you know that the highest number from the EINA table is from an external number range and not from the internal number range?
Also you do not really send any data for info record creation, just an info record number, all other parameters are just a comment in your coding.