I'm not a Bash scripting expert, but it would appear that once you SSH to the remote server, you are expecting the commands that follow (e.g. `rpm -qa | grep kernel`) to execute on that remote server. Well, that's not going to happen.
All you are going to do with your script is connect (via SSH) to the remote server, and then it will sit there until you log out. Then your commands will be execute, but on the local system.
If you want to execute a command on the remote server, try something like:
Code:
KR=$(ssh $server "rpm -qa | grep kernel")
LR=$(ssh $server "last reboot")
...