We don’t know what’s the problem, but I’d give it for granted the keyboard needs to be replaced in any case. Try disconnecting it from the logic board, disconnect battery too, plug in the magsafe. If it boots up correctly all the way keyboard/topcase replacement should solve your problem. If it doesn’t you likely have an issue with the logic board that should be removed and properly cleaned to start with, as @Dmak already recommended. Here’s the guide to help you with the work:
[[MacBook water damage - The definitive guide]]