$pathToXmlFile = "$psPath\format\Web.config"
$xml = new-object System.Xml.XmlDocument
$xml.LoadXml((get-content -Encoding UTF8 $pathToXmlFile))
$createPath = $xml.SelectSingleNode('//configuration/appSettings/add[@key="LogFilePath"]')
New-Item -ItemType Directory -Confirm -Path $createPath.value
# edit
($spXml.SelectSingleNode('//configuration/appSettings/add[@key="LogFilePath"]')).value = "aaa"