I need to play a chord that goes:
I can play a barre chord with my index finger and hold down all the strings on the fifth fret, but I cant hold down the three sevens. Any tips for a beginner?
Like all answers on this site... Practice.. It's hard to barre in the beginning but after a while you will get a hang of it.
One advice I can give you is to practice something like playing an open chord and then an barre chord and back to an open chord and so on... And when playing make sure that all notes play cleanly. I suggest strumming the chords very slowly one string at a time and change chord only when you get it right. If some string does not ring. Remove your grip and start over from the top.
One common mistake is the angle of the wrist. Make sure you sit down when practicing or use a shorter strap.
But the only real advice is just keep practicing.
Start with D5 chord:
then learn Dm barre chord:
and then move to full-blown D barre chord:
You can use another barre with the 3rd finger, to hold strings at 7th fret, instead of 3 fingers. It requires a bit more strength, but a little less stretching.
Variant with 3 fingers:
With another barre:
Also, you can find many tips in related question: How can I best learn to play barre chords?