The Baltic states are moving to bolster NATO’s eastern flank by testing a prototype defensive line in Latvia, part of a wider effort to protect the region’s borders with Russia and Belarus.