Lidocaine is usually used as a numbing agent used to numb a particular area of the skin. For example if you have a skin tag or two, usually the Doctor will inject the area with a needle with Lidocaine in it.
Than proceed to remove a skin tag for example, with a laser device in the exam room. But usually a combination of capsaicin and menthol,in a topical cream or pain patch called Aleveer patch.
But in the case of the Lidocaine shots you received for pain, I really never heard of Doctors using Lidocaine to use fo eliminating pain, except as a numbing agent, in the scenario I just wrote in the beginning of my post here.
However there are also Lidocaine patches and topical ointments containing this ingredient, which I would think would be a bit safer introduced this way, than by injecting it with a needle.