Guessing from final product given here are my steps
I made some guesses which I think are reasonable,
- Though the ortho position is free I added D to meta position cuz of final product.
- I considered NH_4[HCO_2] \rightarrow NH_3 + H_2 + CO_2. H_2 produced will remove oxygen from N atom.
After this SOCl_2 will make the topmost COOH to acid chloride.
D = Guanidine