Here's your function translated (accurately?) into pseudo-code to help with my own understanding (and hopefully others'):
function addItem:
if inventoryList.contains(scannerResult):
inventoryPosition = inventoryList.positionOf(scannerResult)
quantityPosition = quantityList.positionOf(scannerResult)
quantityItem = quantityList.selectListItemAt(quantityPosition)
quantityList.insert(quantityItem at inventoryPosition)
else
inventoryList.add(scannerResult)
quantityList.add(1)
The problem appears to be in the logic when the scanner result is already in the list. I don't know the relevant app-inventor functions, but I think that you want something more like:
if inventoryList.contains(scannerResult):
inventoryPosition = inventoryList.positionOf(scannerResult)
quantity = quantityList.selectListItemAt(inventoryPosition)
quantityList.setListItemAt(quantityPosition to quantity + 1)
That last line is the bit I don't know how to translate into app-inventor language, but hopefully it's enough to point you in the right direction.