There are a few solutions that work here but you need to link two API call responses to each other when the order of results in both outputs may not match.
So you’ll need to devise what works best for your script here and make your own changes as needed.
Throwing in a simple foreach loop isn’t gonna cut it to add the users avatar to their stream output.
So you’ll need to preprocess the output from the two API calls and merge the data before looping the returned records.