Questions, questions. There is so much you should say, but you don't
How is your keyboard connected to the computer? Midi cable (which should be OK) or a usb/Midi converter (some of which can be very bad)?
What is 'A music software'?
Where is the sound coming from, and in what way is it 'poor quality'? If you've got some sort of Virtual Synth on your computer, it may have very bad sounds - some ARE better than others.
As for the latency, I'll GUESS that you're trying to add new tracks beside previously recorded ones, but you don't say. Are the new notes behind the old ones, or is it the other way around - this answer will help suggest where the problem might be.
If you could clarify these matters, we could proceed - although more questions may arise.
Geoff