When a string instrument keeps going out of tune, it is usually a sign that the tuning pegs need tightening. It is best to either learn yourself how to do this, or take the guitar to a repair shop or music instrument shop where they can do this for you.
This is a common problem with older or cheaper instruments. A good quality instrument does not go out of tune after playing a song on it. This also highlights the importance of tuning your instrument regularly in order for it to sounds nice.