Q: Inserting file into other file after pattern How might I insert the content of the file a, followed by a newline,
into the file b, after the first line containing PATTERN?

A: sed '/pattern/{r file_b
a\

:f
n; b f
}' file_a

If file_b is already terminated by a newline, and you don't want an empty line in the output, omit the a\ line from the script.
On the last line, the :f defines a label, n reads a newline (which will be automatically printed since the -n option was not given to sed), and b f branches to the f label, creating a loop. All this in order to append file_b only after the first line matching pattern. If you want to append file_b after each line matching pattern, it's much simpler:
sed '/pattern/r file_b' file_a

Example:
$ cat file_a
first
second
third
fourth
first
second
third
fourth
$ cat file_b
b1
b2
b3

$ sed '/second/{r file_b
:f n; b f }' file_a
first
second
b1
b2
b3
third
fourth
first
second
third
fourth

$ printf "x\ny\nz" >file_c
$ sed '/second/{r file_c
a
:f n; b f }' file_a
first
second
x
y
z
third
fourth
first
second
third
fourth

$ sed '/second/r file_b' file_a
first
second
b1
b2
b3
third
fourth
first
second
b1
b2
b3
third
fourth

Another solution would be using ed(1) (which surprisingly isn't available by default in modern linux distributions, despite being mandated by POSIX and present in all unix systems since 45 years or so):
echo '/pattern/r file_b
w' | ed file_a

This will edit file_a in place and append a newline if there's any at the end of file_b; if you want the output written to another file, change the w to w output_file.

A: How about
sed '/PATTERN/r a' b

