Ex-locksmith here. That’s not always a super-simple fix, but it’s not beyond hope. Hard to tell, from the photo, but I’m guessing the edge of that door is metal. Typically, those doors are pre-built for the latch to go into, including holes in the metal to hold the standard-size screws you’d get with a typical door latch. If that’s the case, then the most-likely scenario is that the inside of the holes have been stripped so badly that typical screws don’t hold in them.
The easiest solution to try is to get flat-head sheet-metal screws that are just a little bit wider (measuring the outside edges of the threads) than the screws you have in there now. Hopefully, they would be able to bite into the metal holes in the door and hold firm. However, you have to try to find screws that are about the same length (so they don’t go in too far and interfere with the mechanism for the knobs), and you want to try to find screws with heads that aren’t too much bigger than the ones you have now–otherwise, the heads may stick out from the edge of the door too much and hit the door latch. So, my recommendation is that you remove one of those screws, and take it to your local hardware store, and try to find screws that fit all of those criteria.