Many new lawnmowers DO NOT have a fuel filter! Thus the carburetor soon gets a particle in it and stops working.
With that said, the first thing I do when I buy a new small engine is install a fuel filter if it does not have one. I just cut the fuel line and stick in an in-line small fuel filter. Use small hose clamps.
Many auto parts stores have these, but the store sales people may be "challenged" to find one without a part number. Ask for an older more experienced salesperson and ask if he can open a few small fuel filter boxes so you can see what would work best. (Write down the part number for next time.)
Looks like this...
https://i.ytimg.com/vi/JNV_cEOyIAo/maxresdefault.jpg
Video...
https://www.youtube.com/watch?v=JNV_cEOyIAo