Below is my code. Currently it updates all the taxonomy field values in the document library. I just need to set a condition where Taxonomy column value(document library) is equal to "Termvalue2" then change to "TermValue1"
$taxonomySession = Get-SPTaxonomySession -site
$termStore = $taxonomySession.TermStores["Managed Metadata Service"]
$termStoreGroup = $termStore.Groups["MyTermGroup"]
$termSet = $termStoreGroup.TermSets["Mytermset"]
$t = $termset.GetAllTerms()
$term = $t["TermValue1"]
##############################
$Site = Get-SPWeb
$List = $Site.Lists["Site Documents"]
$taxField =[Microsoft.SharePoint.Taxonomy.TaxonomyField]$List.Fields["MyField"]
$taxField.GetFieldValue()
foreach($i in $list.Items)
{
$var = $listItems
$taxField.SetFieldValue($i, $term)
$i.update();
}