The short-form video app lost a challenge to a law that will ban TikTok in the United States if its owner, ByteDance, does not sell to a non-Chinese company. It has pledged to appeal to the Supreme Court.