Which is the relation between transactions and blocks? I don't quite understand the relation between a transaction and a block.
I imagine it as a list of blocks, and each block having a list of transactions but I have some doubts.

When I do a transaction...


It should go to a specific block?
An unconfirmed transaction is a transaction which is not inside a block?
Can the miner add the new transaction to an older block? Once a block is solved, new transactions can be added?
The initial statement is correct. The blockchain is the list of all solved blocks, essentially the ledger of all transactions completed in the Bitcoin network. Each block contains (among a few other things) a list of transactions.

When you do a transaction, it is not destined for a specific block. You merely publish your transaction to the network and it goes onto the list of unconfirmed transactions. (There is actually no one authoritative list, however, everyone on the network keeps their own list and distributes it to others to whom they are connected.) Miners (who solve the hashing puzzles required to "solve" a block and make it official) will typically include all unconfirmed transactions in the blocks they create. But they may not. They may just not have received your transaction in their part of the network yet. Or, if your transaction didn't have a fee included, they may only be willing to process transactions with fees. Technically, they are under no obligation about which transactions to include in the block. But since miners get fees from many transactions, and miners benefit from the strength of the Bitcoin network, transactions are typically quickly included in a block.

To answer your second bullet, yes, an unconfirmed transaction is one that has not yet been included in a block.

And to answer your final bullet, no, new transactions cannot be added to older blocks. The "solution" to a block is a mathematically hard puzzle to solve, and it is based on the transactions that are included. So, if you added a transaction to an older block it wouldn't be the same block any more. And the "solution" wouldn't work either, so it would essentially have to be re-mined.

And to further complicate adding a transaction to an older block, each block also includes a piece of information from the previous block in the block chain. Meaning that if you added a transaction to an older block (or modified it in any way), you would not only have to re-solve the old block, but you would have to re-solve all blocks between that block and the current block. And since no one would recognize your re-solved blocks unless you were able to create an even longer blockchain than what currently exists, it isn't realistic to be able to do so. You would have an extremely large amount of processing to and you would have to solve it considerably faster than the rest of the world was working on the old block chain. (The exception is if you have more mining computing power than everyone else in the world combined. This is sometimes called the 51% problem.)

This is all by design. The point of the block chain is that the history of transactions is unalterable and mutually agreed upon as the truth. If it were possible to add transactions into the past, you could change that history. And, for example, spend the same bitcoins twice. But because of this chaining of bitcoins that isn't possible. (It is also why most people don't consider a transaction final until it has "6 confirmations". What "6 confirmations" really means is that the block that it is included in is 6 deep in the block chain. At that point the block chain is deep that it is considered completely unalterable.