The easiest way would be to format your complete output and then call outtextxy just the once.
1 2 3 4 5 6
char buffer[1024] = {0}; // zero the buffer
strcpy(buffer, "Hello");
strcat(buffer, " ");
strcat(buffer, "HI");
settextstyle(2,0,5);
outtextxy(10,40,buffer);
or
1 2 3 4 5
constchar data[] = "HI";
char buffer[1024] = {0}; // zero the buffer
sprintf(buffer, "Hello %s", data);
settextstyle(2,0,5);
outtextxy(10,40,buffer);
You can work out how long a string is, but it's harder work. If you're using BGI, as your fragment suggests, then you'll need to use textwidth() to work out how long the first string is so you can calculate x,y for the second string.
Probably something like (I don't have Borland anymore, so this is from memory...)
1 2 3 4
settextstyle(2,0,5);
outtextxy(10,40,"Hello");
dx = textwidth("Hello "); // with the space
outtextxy(10 + dx,40,"HI");
the real deal is .....we can use styles in output using settextstyle and outtextxy and i want the same same for input also.....which unfortunately I don't know