opendkim-genkey output for 2048 bits is done in three segments

The output is fine if you plan to use it directly in Bind or something that has a compatible format for the zone configuration files.

The brackets make sure Bind interprets all the lines as one record, and it will just concatenate the strings. It outputs like this because the 2048 bit key is fairly long and the opendkim-genkey author must think it's nicer to spread it over a couple of lines rather than have one very long line. (A lot of software developers actually have maximum line length rules for source code - this isn't 'source code' of course but still some people develop an ingrained distaste for long lines)

If you're using an online DNS service, you may find you have to enter it all as one line, in which case yes, just merge the whole thing together (removing the double quotes and brackets).

Additional completely personal preference note - I'm not a fan of the selector "mydomain.com". You'll end up with a DNS entry for mydomain.com._domainkey.mydomain.com. The common one I see is 201706._domainkey.mydomain.com, which shows the year/month the key was generated and allows you to replace the key in future with a new one, whilst keeping the old record in place during the change over. (e.g. In 6 months create a 201712 keypair and start using that, then when you're sure no email signed by the old key is floating about in queues somewhere, delete the 201706 dns entries).