The idea of CAN is actually to use different IDs to be able to distinguish messages. If you send out 5 messages to ID 500 and the counterpart would reply using the same ID or a specific ID that is connected to 500, then the replies would also all have the same ID. You couldn't sort of to which of the 5 sent messages which reply belongs. The code you built is also asynchronous.
I would do it differently. The loops are only for sending and receiving, they don't define the ID. The ID and the related payload would be placed in variables outside of these two loops. The outer loop would this way define what to send and when.