Show your iTunes Music library. In the sidebar (left side of iTunes window), under Library, click Songs. To the right, your music library appears as a plain song list, with columns. Do you see a narrow column with a cloud symbol in its heading?
If you do not, right-click the heading row (to show a menu of all columns), and select iCloud Download (so it has a checkmark next to it). iCloud Download is the name of column with cloud symbol in heading. You can move it (left or right) on the song list, by dragging by its heading. I like putting it immediately to the left of song Name column.
In that cloud column, songs that are only in iCloud have a cloud with down-arrow symbol (the download cloud). You can click that symbol to download the song. But it's be "a bit" tedious to do that thousands of times... 🙂
So, click heading of the cloud column, to sort song list by that column. Now, all songs with download cloud are grouped together on song list. Select them all at the same time. To do this, click first song (with download cloud), scroll song list, press and hold down Shift key, and click last song (with download cloud). The two songs you clicked and all songs in between are selected at the same time. Right-click selection, and Download. With a few thousand songs, it may take a while...