Você pode tentar algo como
awk 'BEGIN{FS = "\n";RS = "\n\n";
print " "}
{ print "<candidate>" }
{ print "<name>"$1"</name>" }
{ print "<marks>"$2"</marks>" }
{ print "<subject>"$3"</subject>" }
{ print "</candidate>" }
{print " " }' input.txt > candiatefinaloutput.xml
E tem o que eu recebo:
[romeo.romeo-PC] ➤ cat 3
Alex
Marks300
SubjectScience
Robin
Marks200
SubjectChemistry
✔
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[2015-05-07 09:00.04] ~/tmp
[romeo.romeo-PC] ➤ awk 'BEGIN{FS = "\n";RS = "\n\n";
print " "}
{ print "<candidate>" }
{ print "<name>"$1"</name>" }
{ print "<marks>"$2"</marks>" }
{ print "<subject>"$3"</subject>" }
{ print "</candidate>" }
{print " " }' 3
<candidate>
<name>Alex</name>
<marks>Marks300</marks>
<subject>SubjectScience</subject>
</candidate>
<candidate>
<name>Robin</name>
<marks>Marks200</marks>
<subject>SubjectChemistry </subject>
</candidate>