google sheets. transfer of data from one sheet to another (in different ranges) according to different conditions

please help with the script. I will briefly describe what is needed: there is a sheet with data, this data must be distributed to another sheet according to the condition.
in detail what needs to be done is written in the table on the “log” sheet
https://docs.google.com/spreadsheets/d/1Kw-H6hte7hriPPUQNzMKGxjiH4fQSN3gyQmNo-WZ8fc/edit?usp=sharing

(list of messages LOG telegrams chat. these messages have data about a stock market transaction

enter image description here

Chat telegram messages will be saved (written) to this list using a script. they look like the one shown above. the first column shows the date and time the message was sent. the second column contains the name of the transaction (RUB / USD / EUR and others). all other columns have additional information for column 2 (transaction date / purchase price / commission / ticker and others).

task: it is necessary to distribute these transactions into the necessary groups on the “distribution” sheet. for example: new data came to the “log” sheet (they always come in the first line, and the old data is shifted below, for more details in the table script). they look like this
enter image description here

data is sorted by color, so it’s easier to explain. column 2 (light red color, has “euro”) – the script must determine that the “euro” group is located in the range “AK: BA” on the “distribution” sheet. and transfer the first data (slightly darker red) “S:J” to the range “AL: AS” on the sheet “distribution” and the second data (dark red) “K: L” to the range “AZ:BA” also to the sheet ” distribution”

that is, everything is carried according to the color to the bottom empty line
cells on the “distribution” sheet of standard red should not change

enter image description here

by the way. column 2 should not be carried over to the “distribution” sheet. it just contains information where the data should be parsed)