In the Lassaigne's test for halogens, the organic compound is fused with sodium metal to convert covalently bonded halogens into ionic sodium halides (NaX).
The sodium extract (Lassaigne's extract) may also contain sodium cyanide (NaCN) and sodium sulfide (Na$_2$S) if the original organic compound contained nitrogen and sulfur, respectively.
Before adding silver nitrate (AgNO$_3$) to test for halide ions, it is essential to decompose any NaCN and Na$_2$S present.
If not removed, these ions would react with AgNO$_3$ to form precipitates of AgCN (white) and Ag$_2$S (black), which would interfere with the identification of the halide precipitate (AgCl, AgBr, AgI).
Concentrated nitric acid (HNO$_3$) is added for this purpose. It acidifies the solution and decomposes NaCN and Na$_2$S into gases.
Na$_2$S + 2HNO$_3$ $\rightarrow$ 2NaNO$_3$ + H$_2$S(g)
NaCN + HNO$_3$ $\rightarrow$ NaNO$_3$ + HCN(g)
After boiling off these gases, the solution is free from interfering ions, and AgNO$_3$ can be added to test specifically for halogens.