Is it possible to create a transaction with 2txin and 2txout? If it is possible, then how does one sign this transaction?
Or do I have to create two separate transactions? 1txin 1txout and 1txin 2txout?
You can definitely do that. Generally speaking you can have any combination of n inputs and k outputs, both n and k being integers.
I'm assuming you want to know how to implement the signing process. The process to sign such a transaction is rather involved. You basically set the signatures on all inputs to an empty string and then iterate through the inputs, copying the transaction with empty signatures, inserting the script of the corresponding output in the signature's place and signing the resulting temporary transaction.
For the exact details see this very extensive explanation blog post.
If on the other hand you're using the Bitcon Core JSON RPC then it's a simple matter of calling
signrawtransaction (API) and passing in a raw, i.e., unsigned transaction. Be careful though as there are no checks when signing this way and the resulting transaction does exactly what you told it to, e.g., it might claim 10 bitcoins and allocate only 1 on the outputs, leaving 9 bitcoins floating for transaction fees and you'll lose them.