There are 2 tasks: numerate apropriate line(s) than format output:
nl -bp[A-Z] -nln abc.txt | 
sed '
     /^\w/{
           s/\(.*\)\(....\)/\2 \1/
           n
           N
           s/\n\s*/ /
          }
     s/^\s*/ /
    ' > xyz.txt
Or if you like awk
awk '
     /[A-Z]/ {
             print $0, ++count
             getline
             printf " %s", $0
             next
     }
     {
             print "", $0
     }
    ' abc.txt > xyz.txt
 
                