During the pandemic, many countries used the national lockdown as a tool to control the number of infections. But there are also countries who didn't choose for the national lockdowns as a tool. Most of those countries used the localized versions of the lockdown. China used an adopted version of a localized quarantine.
The whole idea of a lockdown is to slow down the COVID‑19 transmissions. The theory is to limit contact between people, hence the lockdown. There are counter arguments, which states that a lockdown doesn't work, and there is no contact limitation between people. That argument states that COVID‑19 transmissions increase because more people concentrate at fewer places.
However, the W.H.O. states the following:
However, these measures can have a profound negative impact on individuals, communities, and societies by bringing social and economic life to a near stop. Such measures disproportionately affect disadvantaged groups, including people in poverty, migrants, internally displaced people and refugees, who most often live in overcrowded and under resourced settings, and depend on daily labour for subsistence. (source)
Whoever is right or wrong, I took the data from "Novel Coronavirus (COVID-19) Cases, provided by JHU CSSE" and produced charts of new infections and the lockdowns graphically inserted. The results you see here beneath.
And because pictures do tell more than thousands of words, I only tell it in pictures. You'll see at the results if a lockdown was needed and so yes, did it help. Some countries enforced a national lockdown, but was that really needed and some countries applied a national lockdown and obviously canceled it.