Requirement: In the case of any comparison purpose in the script, how can we differentiate each line when there are multiple item lines with the same item?
For that, we can create a saved search and include a Formula text column in the results using the expression {number}||’_’||{line}. Here, the {number} represents the document number of the invoice, and {line} represents the line ID. By concatenating these two values, we can create a new column like INV0935_0. In this example, INV0935 is the invoice number, and 0 is the line number. If the same item exists in multiple lines, we can distinguish each line by appending the line number to the invoice number using this method.

The result will be like,
