Is your input space delimited? You can loop over the fields starting on field 2 with increments of 2 and print the first field and the current field plus its right hand neighbor...
If it is fixed width you can call substring functions to specify the fields...
I find it very hard to reconcile your statements (A is character length 10) with ("A" which is length 1); (Xi is character length 4) with ("X1", "X2", and "X3" which are all length 2); and (Yi is numeric length 10) with ("Y1", "Y2", and "Y3" which are all length 2 and none of them are numeric).
Please show us a sample input file that contains real data (or fake data that matches the format of your real input file(s)) and the actual output that you are trying to produce from that sample input file. And, use CODE tags for both the sample input and the desired output.