Introduction to Minecraft storage subcommands
Storage subcommands

The storage subcommand allows the command to store the result or number of successes returned by the command in the scoreboard, NBT data, or boss column after execution. There are two modes: store result and store success. Note that the return value of the command must be an integer. If it is a decimal, it will be rounded down. The return value of each command is recorded in a table or text on the corresponding page. This section is relatively complex, so only the purpose is explained.
There are five different storage modes:
store (result|success) block - stores in the block NBT
store (result|success) bossbar - stores in the bossbar data
store (result|success) entity - stores in an entity's NBT
store (result|success) score - stores in the target's score
store (result|success) storage - stores in storage NBT
block
Stores the command's return value as a tag in the block entity. Can be stored as bytes, short, int, long, float, or double. If the return value is a decimal, it is rounded down and then multiplied by a certain <scale>.
bossbar
Stores the command's return value as the current or maximum value of the bossbar.
entity
Multiplies the return value or number of successes by <scale> and stores it in the <path> of the NBT tag of <target>, and stores it in the specified NBT format. If the return value is a decimal, it is rounded down and multiplied by <scale>. As with /data, the player's NBT cannot be modified.
score
Use the storage <path> to store the return value or number of successes in the specified data type. If the return value is a decimal, it is rounded down and multiplied by the specified <scale>. If the storage does not exist, it will be created.