I've played guitar for 15 years and professionally for over 5 of them, and I've experienced that whenever I try to learn something new and hard, I always give up about 3 or 4 times....! I give up, leave it to work on something else and then come back to it with new energy. Eventually I get it!
It takes time to build up the left/right hand coordination to the point where you can play a melody and make it sound like music. So just keep doing it and have fun with it, you can try a different melody, a different guitar, a different key or anything to change it up for yourself.
As far as the chords go, you have to realize that you are using your fingers in an entirely new way and forcing them into positions they are not used to! So go easy on yourself when it doesn't sound right! Here is some general advice:
1) Start with easy chords! Em, A7, Am, A7 etc. Chords that don't require barring or any kinds of finger stretching! Make up simple progressions and work on your right hand strumming. This will give you a chance to feel like you're making music. Try for example to play 2 bars of Em and 2 bars of A7 and make it sound really good.
2) If a chord doesn't sound right make sure
- you are fretting with the very tip of your fingers
- that your fingers hit the fret board from a straight angle (Otherwise they might mute other strings)
- your LH thumb is in the right place. Sometimes it helps if it's in the middle of the neck, sometimes it helps if it's almost touching the low E-string. Try it out!
- make sure you are holding your guitar right. If for example your neck points toward the floor it will be nearly impossible for you LH to get it.
- try to hold the chord and play one string at the time, to find out where the problem is.
Hope this helps! Just keep going, we've all been there and we all came out alive:)
Anders