the nitrite ion is an ambident anion, as it can react either at nitrogen or at oxygen which is negatively charged
therefore the product could either be nitroalkane or nitrite depending on the conditions and the reactants
the reason of using AgNO2 is because Ag+ and X- could form precipitate AgX, which moves the equilibrium rightwards