The program flow doesn't return control to the loop

One problem I see:

  char inByte[6] = {0};
  
[...]
        inByte[6]=0;

You only have 6 elements in your array, numbered 0-5. You're writing outside of the array.

But I believe the reason you never get back to the top of the loop is this while:

        while(i<1){

          char key2 = keypad.getKey();
          switch(key2)
          {

          case '0':
            {
[...]
            }

            break;
          case '1':
            {
[...]
            }
            break;
          }

Once you enter the loop you never set "i" again so you're stuck.

Also you don't need the extra brackets in your switch/case statement.

Hope this helps,

Brad
KF7FER