Help with shell script

I/P file has data as follows:

Y
REQUIRES Z
A
REQUIRES B
C
REQUIRES D
REQUIRES E
REQUIRES F
 G
REQUIRES H
I 
REQUIRES J

EXACT OUTPUT FILE REQUIRED:

Y REQUIRES Z
A REQUIRES B
C REQUIRES D
C REQUIRES E
C REQUIRES F
G REQUIRES H
I REQUIRES J

I am using while loops to traverse the file.

while read line
do
if (condition)
{..
}
while read anoterline
do
done
done <inputfile

The problem I am facing is that
1) when inner while loop traverses say 4 lines and i break the inner loop the outer while loop's offset is set to the offset at which the inner while has stopped.
2)So I am missing the 4 lined data in execution of my outer loop. I need the outer while loop to start off from the offset at which it had stopped.

I'm not sure if I understood the problem. I would suggest you to post your complete shell script.

By the way you could also do this using awk:

awk 'NF==1{v=$1}NF>1{print v,$0}' file

In addition to what Yoda said, you also need to tell us what operating system and shell you're using. The syntax you've shown us doesn't look right for the shells most of us use.