You should try @devnull's answer with /usr/xpg4/bin/awk or nawk.
Many of the programs under /usr/bin and /bin on Solaris are not POSIX compatible.
Or you can use perl for portable:
$ perl -nle '
unless (/,/) {
push @a, $_;
next;
}
@l = split ",", $_;
print "$a[$i++],$l[1]";
' file2.txt file1.txt
xyz,sachin
pressure,kumar
Even shorter:
$ perl -F',' -anle '
if (@F == 1) {push @a,$_;next}
print "$a[$i++],$F[1]";
' file2.txt file1.txt