Welcome to the forum and good luck finding someone who can help with the wiring. Basically you are relying one someone who has the same unit as yours, with the exact same wiring, has done the job before, and has the memory and knowledge to share in this forum. I am not that person.
I can only provide some general information based on the good, but inadequate photos provided. Generally, the color of a wire means little. And the color of a wire cannot be relied upon when making electrical connections. The green wire in the photo is a chassis “ground wire.” Red wire is usually wire used for “positive 12V DC circuits.” Black wires are usually used for “hot (line) 120V AC circuits.” White wires are generally used for both “12V DC and 120V AC neutral circuits,” Blue and brown can be used for anything, although blue and brown are not usually used as a ground or neutral wire. These are only general wire color destinations in the industry and by no means may have anything to do with your water heater installation. Yet no water heater brand or model number has been provided. Most installation manuals are on the Internet and I think a new water heater should be supplied with installation instructions, including its electrical connections to go by rather than wire colors.