What you want to do is to join the module lines with the next line.
Using sed:
$ sed '/^module/N;s/\n//' file
module x(a,b,c)
module y(d,e,f,
g,h,i)
module z(j,k,l)
This is with your data copied and pasted as is, with spaces at the end of each line.
The sed command will print each line as it is read, but when it encounters a line that starts with the string module, it appends the next line with an embedded newline character in-between (this is what N does). We remove that newline character with a substitution before the result is printed.
If your data has no spaces at the end of the lines, use
$ sed '/^module/N;s/\n/ /' file
module x(a,b,c)
module y(d,e,f,
g,h,i)
module z(j,k,l)
Just in case you'd want this (assuming no spaces at end of input lines):
$ sed -e '/^module/bpp' -e '$bpp''H;$bpp' -e 'H;d''d' \
-e ':pp' -e 'x;/^$/d;s/\n//g' file
module x(a,b,c)
module y(d,e,f, g,h,i)
module z(j,k,l)
Annotated sed script:
/^module/ b print_previous; # print previous record
$H; b print_previous; # print previous (last) record
H; # append this line to hold space
$ #b addprint_previous; this# lineprint toprevious hold(last) spacerecord
d; # end processing this line
:print_previous; # prints a record accumulated in the hold space
x; # swap in the hold space
/^$/ d; # if line is empty, delete it
s/\n//g; # delete all embedded newlines
# (implicit print)