Am I supposed to hold the chord with the right hand and also play the melody with the right hand?
There's a pedal on the right just for this kind of scenario! Since the harmony doesn't change throughout the bar, it's o.k. to press that pedal just after you play the chord, to keep it going through the bar. Then lift the pedal just as you play the first notes in the following bar.
If you happen to have a piano with three pedals, and the middle one is a sostenuto pedal (rather than a practice pedal) that will do the job as well - possibly better, as you will elongate only the chord in question. Along with the bass note, of course!
Knowing where in the world you are would make the answer make more sense, regarding the middle pedal.