user87148: My understanding of how a transaction is secured in blockchain, especially in bitcoin, is that the output of transaction data is locked to the recipient's address (a shorter version of his public key). When the recipient decides to use the token locked to his address, he generates a digital signature using his private key and runs a CHECKSIG function on his address and the digital signature to prove that he owns the private key. I assume the CHECKSIG function will return a True and unfreeze the cryptocurrency if the digital signature matches the locked address (i.e., public key).
However, it looks like the transaction is just a number concatenating outbound address and recipient's address plus the inputs and outputs (i.e., how much money is exchanged between two addresses). This website provides a closer look at the components of transaction data.


Then how is the actual transaction data stored, encrypted and sent via
  blockchain?

For example, if A decides to buy some merchandise from B using cryptocurrency (merchandise can be digitalized, say, some valuable digital files), how are these files stored, encrypted and sent to B on the blockchain? Does blockchain technology handle the security issue of the actual digital merchandise?

user13866: As Satoshi Nakamoto put it:

Transactions  that  are  computationally  impractical  to   reverse   would  protect  sellers from fraud, and routine escrow mechanisms could easily be implemented to protect buyers. 

Bitcoin in particular, and probably most other cryptocurrencies, are primarily concerned with moving money from actor A to actor B without needing to trust actor C. They generally do not address how to guarantee, without a trusted intermediary of some sort, that goods will subsequently move from B's control to A's control.
In the Bitcoin world, blockchain mining fees apply on a per-byte basis, so adding a digital "Game of Thrones complete 4K video series" to the blockchain would not be feasible. It isn't a delivery mechanism itself.
There's an interesting whitepaper on escrow as a solution with a good set of references

We consider the problem of buying physical goods with cryp-
  tocurrencies.  There  is  an  inherent  circular  dependency:  should  be  the
  buyer trust the seller and pay before receiving the goods or should the
  seller trust the buyer and ship the goods before receiving payment? This
  dilemma is addressed in practice using a third party escrow service. How-
  ever, we show that naive escrow protocols introduce both privacy and
  security issues. We formalize the escrow problem and present a suite of
  schemes with improved security and privacy properties. Our schemes are
  compatible with Bitcoin and similar blockchain-based cryptocurrencies.

The first reference is to Atomic Cross-chain trading which begins to address the exchange of digital assets.

user48884: 
how are these files stored, encrypted and sent to B on the blockchain?

They aren't. Those files are not stored on the blockchain nor are they transmitted to B using the blockchain.

Does blockchain technology handle the security of the actual digital merchandise?

It can, if you make one that does. Bitcoin's does not.

87148: <p>My understanding of how a transaction is secured in blockchain, especially in bitcoin, is that the output of transaction data is locked to the recipient's address (a shorter version of his public key). When the recipient decides to use the token locked to his address, he generates a digital signature using his private key and runs a <code>CHECKSIG</code> function on his address and the digital signature to prove that he owns the private key. I assume the <code>CHECKSIG</code> function will return a <code>True</code> and unfreeze the cryptocurrency if the digital signature matches the locked address (i.e., public key).</p>

<p>However, it looks like the transaction is just a <code>number</code> concatenating outbound address and recipient's address plus the inputs and outputs (i.e., how much money is exchanged between two addresses). This <a href="http://learnmeabitcoin.com/glossary/transaction-data" rel="nofollow noreferrer">website</a> provides a closer look at the components of transaction data.</p>

<hr>

<blockquote>
  <p>Then how is the actual transaction data stored, encrypted and sent via
  blockchain?</p>
</blockquote>

<p>For example, if A decides to buy some merchandise from B using cryptocurrency (merchandise can be digitalized, say, some valuable digital files), how are these files <strong>stored</strong>, <strong>encrypted</strong> and <strong>sent</strong> to B on the blockchain? Does blockchain technology handle the security issue of the actual digital merchandise?</p>
 13866: <p>As Satoshi Nakamoto <a href="https://bitcoin.org/bitcoin.pdf" rel="nofollow noreferrer">put it</a>:</p>

<blockquote>
  <p>Transactions  that  are  computationally  impractical  to   reverse   would  protect  sellers from fraud, and routine escrow mechanisms could easily be implemented to protect buyers. </p>
</blockquote>

<p>Bitcoin in particular, and probably most other cryptocurrencies, are primarily concerned with moving money from actor A to actor B without needing to trust actor C. They generally do not address how to guarantee, without a trusted intermediary of some sort, that goods will subsequently move from B's control to A's control.</p>

<p>In the Bitcoin world, blockchain mining fees apply on a per-byte basis, so adding a digital "Game of Thrones complete 4K video series" to the blockchain would not be feasible. It isn't a delivery mechanism itself.</p>

<p>There's an <a href="http://www.jbonneau.com/doc/GBGN17-FC-physical_escrow.pdf" rel="nofollow noreferrer">interesting whitepaper on escrow as a solution</a> with a good set of references</p>

<blockquote>
  <p>We consider the problem of buying physical goods with cryp-
  tocurrencies.  There  is  an  inherent  circular  dependency:  should  be  the
  buyer trust the seller and pay before receiving the goods or should the
  seller trust the buyer and ship the goods before receiving payment? This
  dilemma is addressed in practice using a third party escrow service. How-
  ever, we show that naive escrow protocols introduce both privacy and
  security issues. We formalize the escrow problem and present a suite of
  schemes with improved security and privacy properties. Our schemes are
  compatible with Bitcoin and similar blockchain-based cryptocurrencies.</p>
</blockquote>

<p>The first reference is to <a href="https://en.bitcoin.it/wiki/Atomic_cross-chain_trading" rel="nofollow noreferrer">Atomic Cross-chain trading</a> which begins to address the exchange of digital assets.</p>
 48884: <blockquote>
  <p>how are these files stored, encrypted and sent to B on the blockchain?</p>
</blockquote>

<p>They aren't. Those files are not stored on the blockchain nor are they transmitted to B using the blockchain.</p>

<blockquote>
  <p>Does blockchain technology handle the security of the actual digital merchandise?</p>
</blockquote>

<p>It can, if you make one that does. Bitcoin's does not.</p>
