ITerm2 breaks lines when pasting
iTerm2 splits large text into chunks and then sends these chunks with some small delay. This happens because because iTerm2 has very small delay by default.
To fix large text pasting you can change chunk size and delay options using defaults command. Just run commands bellow in your iTerm2:
defaults write com.googlecode.iterm2 QuickPasteBytesPerCall -int 1024
defaults write com.googlecode.iterm2 QuickPasteDelayBetweenCalls -float 0.08