Hello and welcome to Tom's Hardware Forums.
The ribbon cable connecting the keyboard to the motherboard is very fragile and yours is probably damaged. Start by trying to get your money back on the keyboard - your original might work properly - and buy a replacement cable instead. That said, check that you can unearth the other end first - it may be cheaper to take the laptop to a profession fixer.