Monitoring Centers. Lymphatic system absorbs/carries things too big to go into the arteries/veins like bacteria eaten by white cells and digested food. Lymph nodes "taste" the lymph for anything bad like bacteria/viruses/cancers, etc. When it detects a problem, it alerts the immune system and your body reacts. They enlarge in response to the inflammation they create when they react. They shrink when all is well.
Infection. If you do have an infected node, there may be a source of infection that may need to be identified in the groin area or lower leg. It should be treated with antibiotics. The infection may cause the scarring if not treated.