So they do not feel pain. They avoid damage, but to say that damage avoidance equals pain is to project your experience onto the bacteria. A bacteria is genetically determined and cannot go against instinct. It cannot reason. A bacteria does not need to reason.
Any organism can experience pain and pleasure as long as it has the necessary receptors.
Our ultimate purpose for being here is to enjoy life, but not everyone is consciously or rationally aware of this fact. Perhaps most especially yourself. They continue to thrive, but they obviously do so for reasons unrelated to hedonism. An organism obviously does not need to experience feelings in order to live. As I have said before numerous times, there are probably some organisms we would have to exclude from the argument simply due to the nature of the question.