Police said they were examining “very concerning online writings and social media posts” linked to a teenage gunman who killed a fellow pupil in a Nashville high school cafeteria.