Appending to file with new ID

I have a file that looks like this:

 
1|A
2|B
3|C
...
...
100|A
 

I would like to take the last line in the file and add +1 to the number so
the output looks like this

 
 
1|A
2|B
3|C
...
...
100|XXX
101|A
102|B
103|C
...
...
200|XXX
 

Can somebody provide me with a command to do this?

Thanks in advance to all who help

Not clear. Your explanation and example doesn't match at least for me.

the last line is 100|A . What you want to do with that? How the original lines are there on the output and what does the XXX means?

Apologies, the original file should be 100|XXX

Basically I want to increment the first col with the next number and keep the rest of the line

Is it one time activity? If you know the last number, it makes it simple

 awk -F\| '{a[NR+100]=$2;print} END {for (i in a) {print i FS a}}' file

Let us know if you dont want hard coding last number (i.e. 100) and want to automate that.

Secondly, As of now, array loop is giving me the order as expected. but its not true for awk array. if you have gawk , it will come handy then.

awk 'BEGIN{FS=OFS="|"}
  {a[++n] = $1; b[$1] = $2; print $0}
  END {for(i = 1; i <= n; i++) print a[n] + i, b[a]}' file